[gdal] 02/07: Imported Upstream version 2.0.2~rc1+dfsg

Sebastiaan Couwenberg sebastic at moszumanska.debian.org
Fri Jan 22 17:32:57 UTC 2016


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

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

commit 2867b3b7a2cff7b37ce2fea3debe8e0f0a0d30a6
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Fri Jan 22 16:06:49 2016 +0100

    Imported Upstream version 2.0.2~rc1+dfsg
---
 GDALmake.opt.in                                    |   2 +-
 NEWS                                               | 177 ++++++-
 VERSION                                            |   2 +-
 aclocal.m4                                         |   3 +-
 alg/gdalwarpoperation.cpp                          |  44 +-
 apps/gdaladdo.cpp                                  |   6 +-
 apps/gdaldem.cpp                                   |   4 +-
 apps/gdalserver.c                                  |   5 +-
 apps/gdalwarp.cpp                                  |  21 +-
 apps/ogr2ogr.cpp                                   |  17 +-
 configure                                          | 420 ++++++++++++----
 data/gml_registry.xml                              |   2 +-
 data/ruian_vf_ob_v1.gfs                            |  92 +++-
 data/ruian_vf_v1.gfs                               |  26 +-
 dist_docs/README_UNX_BIN.TXT                       |  71 +++
 dist_docs/README_WIN_BIN.TXT                       |  86 ++++
 dist_docs/SETUP_GDAL.BAT                           |  24 +
 dist_docs/burnpath.c                               | 113 +++++
 dist_docs/install_unx.sh                           |  70 +++
 doxygen_sqlite3.db                                 | Bin 0 -> 162816 bytes
 frmts/bsb/bsb_read.c                               |  23 +-
 frmts/gtiff/geotiff.cpp                            | 126 +++--
 frmts/gtiff/gt_wkt_srs.cpp                         |  59 ++-
 frmts/hfa/hfaband.cpp                              |  11 +-
 frmts/hfa/hfaentry.cpp                             |  10 +-
 frmts/kmlsuperoverlay/kmlsuperoverlaydataset.cpp   |  42 +-
 frmts/netcdf/netcdfdataset.cpp                     |  98 ++--
 frmts/nitf/ecrgtocdataset.cpp                      |  12 +-
 frmts/nitf/nitffile.c                              |  32 +-
 frmts/pdf/pdfdataset.cpp                           |  23 +-
 frmts/pds/frmt_pds.html                            |  31 +-
 frmts/pds/pdsdataset.cpp                           |  10 +-
 frmts/pds/vicardataset.cpp                         |   6 +-
 frmts/pds/vicarkeywordhandler.cpp                  |  88 ++--
 frmts/raw/btdataset.cpp                            |   4 +-
 frmts/usgsdem/usgsdem_create.cpp                   |  24 +-
 frmts/vrt/vrtdataset.cpp                           |  11 +-
 frmts/vrt/vrtrasterband.cpp                        |   6 +-
 frmts/vrt/vrtrawrasterband.cpp                     |  10 +-
 frmts/vrt/vrtsources.cpp                           |   6 +-
 frmts/wms/wmsdriver.cpp                            |  11 +-
 frmts/xpm/xpmdataset.cpp                           |  38 +-
 gcore/gdal_mdreader.cpp                            |   8 +-
 gcore/gdal_priv.h                                  |   8 +-
 gcore/gdal_version.h                               |   6 +-
 gcore/gdaldataset.cpp                              |  65 ++-
 gcore/gdaldllmain.cpp                              |  11 +-
 gcore/gdalpamrasterband.cpp                        |   7 +-
 gcore/gdalproxypool.cpp                            |   6 +-
 gcore/gdalrasterband.cpp                           |  19 +-
 gcore/gdalrasterblock.cpp                          |   8 +-
 m4/ax_lib_libkml.m4                                | 310 ++++++------
 m4/pkg.m4                                          | 157 ++++++
 man/man1/_home_rouault_dist_wrk_gdal_apps_.1       |  93 ++++
 man/man1/gdal-config.1                             |   3 +-
 man/man1/gdal2tiles.1                              |   5 +-
 man/man1/gdal_calc.1                               |   6 +-
 man/man1/gdal_contour.1                            |   6 +-
 man/man1/gdal_edit.1                               |   4 +-
 man/man1/gdal_fillnodata.1                         |   5 +-
 man/man1/gdal_grid.1                               |  28 +-
 man/man1/gdal_merge.1                              |   7 +-
 man/man1/gdal_polygonize.1                         |   5 +-
 man/man1/gdal_proximity.1                          |   5 +-
 man/man1/gdal_rasterize.1                          |   7 +-
 man/man1/gdal_retile.1                             |  10 +-
 man/man1/gdal_sieve.1                              |   5 +-
 man/man1/gdal_translate.1                          |   8 +-
 man/man1/gdal_utilities.1                          |   2 +-
 man/man1/gdaladdo.1                                |  12 +-
 man/man1/gdalbuildvrt.1                            |   9 +-
 man/man1/gdalcompare.1                             |   5 +-
 man/man1/gdaldem.1                                 |  11 +-
 man/man1/gdalinfo.1                                |   6 +-
 man/man1/gdallocationinfo.1                        |   7 +-
 man/man1/gdalmanage.1                              |  14 +-
 man/man1/gdalmove.1                                |   5 +-
 man/man1/gdalsrsinfo.1                             |  27 +-
 man/man1/gdaltindex.1                              |  37 +-
 man/man1/gdaltransform.1                           |   9 +-
 man/man1/gdalwarp.1                                |   7 +-
 man/man1/nearblack.1                               |   5 +-
 man/man1/ogr2ogr.1                                 |  14 +-
 man/man1/ogr_utilities.1                           |   2 +-
 man/man1/ogrinfo.1                                 |  11 +-
 man/man1/ogrlineref.1                              |   6 +-
 man/man1/ogrtindex.1                               |   6 +-
 man/man1/pct2rgb.1                                 |   5 +-
 man/man1/rgb2pct.1                                 |   6 +-
 nmake.opt                                          |   7 +-
 ogr/ogr_srs_api.h                                  |  22 +-
 ogr/ogr_srs_esri.cpp                               |  19 +-
 ogr/ogrfeature.cpp                                 |  24 +-
 ogr/ogrsf_frmts/csv/ogrcsvlayer.cpp                |   6 +-
 ogr/ogrsf_frmts/generic/ogr_gensql.cpp             |  23 +-
 ogr/ogrsf_frmts/generic/ogrlayer.cpp               |  20 +-
 ogr/ogrsf_frmts/geojson/ogr_geojson.h              |   4 +-
 ogr/ogrsf_frmts/geojson/ogrgeojsonreader.cpp       |   4 +-
 ogr/ogrsf_frmts/geojson/ogrgeojsonwritelayer.cpp   |  33 +-
 ogr/ogrsf_frmts/gml/gmlhandler.cpp                 |   9 +-
 ogr/ogrsf_frmts/gml/ogrgmldatasource.cpp           |   6 +-
 ogr/ogrsf_frmts/gpkg/gdalgeopackagerasterband.cpp  | 205 +++++++-
 ogr/ogrsf_frmts/gpx/ogrgpxlayer.cpp                |   8 +-
 ogr/ogrsf_frmts/ili/drv_ili.html                   |   4 +
 ogr/ogrsf_frmts/ili/ili1reader.cpp                 |  31 +-
 ogr/ogrsf_frmts/ili/ogrili1layer.cpp               |  38 +-
 ogr/ogrsf_frmts/mitab/drv_mitab.html               |   7 +-
 ogr/ogrsf_frmts/mitab/mitab.h                      |  11 +-
 ogr/ogrsf_frmts/mitab/mitab_feature.cpp            |   2 +-
 ogr/ogrsf_frmts/mitab/mitab_feature_mif.cpp        |  43 +-
 ogr/ogrsf_frmts/mitab/mitab_indfile.cpp            |   1 +
 ogr/ogrsf_frmts/mitab/mitab_mapcoordblock.cpp      |   1 +
 ogr/ogrsf_frmts/mitab/mitab_mapfile.cpp            |  98 ++--
 ogr/ogrsf_frmts/mitab/mitab_mapheaderblock.cpp     |  30 +-
 ogr/ogrsf_frmts/mitab/mitab_mapindexblock.cpp      |  20 +-
 ogr/ogrsf_frmts/mitab/mitab_mapobjectblock.cpp     |   5 +-
 ogr/ogrsf_frmts/mitab/mitab_maptoolblock.cpp       |   5 +-
 ogr/ogrsf_frmts/mitab/mitab_middatafile.cpp        |   6 +-
 ogr/ogrsf_frmts/mitab/mitab_ogr_datasource.cpp     |  22 +-
 ogr/ogrsf_frmts/mitab/mitab_ogr_driver.cpp         |   1 +
 ogr/ogrsf_frmts/mitab/mitab_ogr_driver.h           |   1 +
 ogr/ogrsf_frmts/mitab/mitab_priv.h                 |  24 +-
 ogr/ogrsf_frmts/mitab/mitab_rawbinblock.cpp        |  25 +-
 ogr/ogrsf_frmts/mitab/mitab_spatialref.cpp         |   2 +-
 ogr/ogrsf_frmts/mitab/mitab_tabfile.cpp            |  31 +-
 .../mssqlspatial/ogrmssqlspatiallayer.cpp          |  45 +-
 ogr/ogrsf_frmts/ntf/ntfrecord.cpp                  |   8 +-
 .../openfilegdb/ogropenfilegdblayer.cpp            |   4 +-
 ogr/ogrsf_frmts/pg/ogrpgdatasource.cpp             |  16 +-
 ogr/ogrsf_frmts/pgdump/ogrpgdumpdatasource.cpp     |   9 +-
 ogr/ogrsf_frmts/shape/ogrshapelayer.cpp            |   7 +-
 ogr/ogrsf_frmts/shape/shape2ogr.cpp                |  11 +-
 ogr/ogrsf_frmts/vrt/ogrvrtlayer.cpp                |  10 +-
 port/cpl_path.cpp                                  |   7 +-
 port/cpl_string.cpp                                |  67 ++-
 port/cpl_vsil_stdout.cpp                           |   6 +-
 swig/csharp/const/GdalConst.cs                     |   2 +-
 swig/csharp/const/GdalConstPINVOKE.cs              |   2 +-
 swig/csharp/const/gdalconst_wrap.c                 |  22 +-
 swig/csharp/gdal/Access.cs                         |   2 +-
 swig/csharp/gdal/AsyncReader.cs                    |   2 +-
 swig/csharp/gdal/AsyncStatusType.cs                |   2 +-
 swig/csharp/gdal/Band.cs                           |   2 +-
 swig/csharp/gdal/CPLErr.cs                         |   2 +-
 swig/csharp/gdal/ColorEntry.cs                     |   2 +-
 swig/csharp/gdal/ColorInterp.cs                    |   2 +-
 swig/csharp/gdal/ColorTable.cs                     |   2 +-
 swig/csharp/gdal/DataType.cs                       |   2 +-
 swig/csharp/gdal/Dataset.cs                        |   2 +-
 swig/csharp/gdal/Driver.cs                         |   2 +-
 swig/csharp/gdal/GCP.cs                            |   2 +-
 swig/csharp/gdal/Gdal.cs                           |   2 +-
 swig/csharp/gdal/GdalPINVOKE.cs                    |   2 +-
 swig/csharp/gdal/MajorObject.cs                    |   2 +-
 swig/csharp/gdal/PaletteInterp.cs                  |   2 +-
 swig/csharp/gdal/RATFieldType.cs                   |   2 +-
 swig/csharp/gdal/RATFieldUsage.cs                  |   2 +-
 swig/csharp/gdal/RIOResampleAlg.cs                 |   2 +-
 swig/csharp/gdal/RWFlag.cs                         |   2 +-
 swig/csharp/gdal/RasterAttributeTable.cs           |   2 +-
 swig/csharp/gdal/ResampleAlg.cs                    |   2 +-
 .../gdal/SWIGTYPE_p_p_GDALRasterBandShadow.cs      |   2 +-
 swig/csharp/gdal/Transformer.cs                    |   2 +-
 swig/csharp/gdal/XMLNode.cs                        |   2 +-
 swig/csharp/gdal/XMLNodeType.cs                    |   2 +-
 swig/csharp/gdal/gdal_wrap.cpp                     |  42 +-
 swig/csharp/ogr/CoordinateTransformation.cs        |   2 +-
 swig/csharp/ogr/DataSource.cs                      |   2 +-
 swig/csharp/ogr/Driver.cs                          |   2 +-
 swig/csharp/ogr/Envelope.cs                        |   2 +-
 swig/csharp/ogr/Envelope3D.cs                      |   2 +-
 swig/csharp/ogr/Feature.cs                         |   2 +-
 swig/csharp/ogr/FeatureDefn.cs                     |   2 +-
 swig/csharp/ogr/FieldDefn.cs                       |   2 +-
 swig/csharp/ogr/FieldSubType.cs                    |   2 +-
 swig/csharp/ogr/FieldType.cs                       |   2 +-
 swig/csharp/ogr/GeomFieldDefn.cs                   |   2 +-
 swig/csharp/ogr/Geometry.cs                        |   2 +-
 swig/csharp/ogr/Justification.cs                   |   2 +-
 swig/csharp/ogr/Layer.cs                           |   2 +-
 swig/csharp/ogr/Ogr.cs                             |   2 +-
 swig/csharp/ogr/OgrPINVOKE.cs                      |   2 +-
 swig/csharp/ogr/Osr.cs                             |   2 +-
 swig/csharp/ogr/OsrPINVOKE.cs                      |   2 +-
 swig/csharp/ogr/SpatialReference.cs                |   2 +-
 swig/csharp/ogr/StyleTable.cs                      |   2 +-
 swig/csharp/ogr/ogr_wrap.cpp                       |  42 +-
 swig/csharp/ogr/osr_wrap.cpp                       |  42 +-
 swig/csharp/ogr/wkbByteOrder.cs                    |   2 +-
 swig/csharp/ogr/wkbGeometryType.cs                 |   2 +-
 swig/csharp/osr/CoordinateTransformation.cs        |   2 +-
 swig/csharp/osr/Osr.cs                             |   2 +-
 swig/csharp/osr/OsrPINVOKE.cs                      |   2 +-
 swig/csharp/osr/SpatialReference.cs                |   2 +-
 swig/csharp/osr/osr_wrap.cpp                       |  42 +-
 swig/include/perl/gdal_perl.i                      |   4 +-
 swig/include/perl/ogr_perl.i                       |  14 +-
 swig/java/GNUmakefile                              |   6 +-
 swig/perl/MANIFEST                                 |   3 +-
 swig/perl/Makefile.PL                              | 486 +++++++++++++++----
 swig/perl/README                                   |  38 +-
 swig/perl/gdal_wrap.cpp                            | 212 ++++----
 swig/perl/gdalconst_wrap.c                         | 484 +++++++++----------
 swig/perl/lib/Geo/GDAL.pm                          |   6 +-
 swig/perl/lib/Geo/GDAL/Const.pm                    |   2 +-
 swig/perl/lib/Geo/OGR.pm                           |  14 +-
 swig/perl/lib/Geo/OSR.pm                           |   2 +-
 swig/perl/ogr_wrap.cpp                             | 415 ++++++++--------
 swig/perl/osr_wrap.cpp                             | 532 ++++++++++-----------
 swig/perl/t/00.t                                   |   4 +-
 swig/perl/t/01.t                                   |   3 +-
 swig/perl/t/02.t                                   |   1 +
 swig/perl/t/03.t                                   |  19 +-
 swig/perl/t/gdal.t                                 |  65 +--
 swig/perl/t/ogr.t                                  | 442 +----------------
 swig/perl/t/osr.t                                  |   6 +-
 swig/python/scripts/gdalmove.py                    |  14 +-
 swig/python/setup.py                               |   2 +-
 218 files changed, 4269 insertions(+), 2665 deletions(-)

diff --git a/GDALmake.opt.in b/GDALmake.opt.in
index aeeda92..672d73a 100644
--- a/GDALmake.opt.in
+++ b/GDALmake.opt.in
@@ -89,7 +89,7 @@ GDAL_INCLUDE	=	-I$(GDAL_ROOT)/port -I$(GDAL_ROOT)/gcore \
 # libtool targets and help variables
 LIBGDAL	:=		libgdal.la
 LIBGDAL_CURRENT	:=	20
-LIBGDAL_REVISION	:=	1
+LIBGDAL_REVISION	:=	2
 LIBGDAL_AGE	:=	0
 
 # native build targets and variables
diff --git a/NEWS b/NEWS
index bd2bdb0..424ed9b 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,178 @@
+= GDAL/OGR 2.0.2 Release Notes = 
+
+The 2.0.2 release is a bug fix release.
+
+== Build(Windows) ==
+ * Fix linking error with MSVC_VER=1900 (VS 2015) (#6255)
+
+== Build(Unix) ==
+ * Add pkg-config support for libkml fork, in addition to the old detection method. The libkml/libkml fork on GitHub supports pkg-config and no longer includes the third_party libraries. (#6077)
+ * gdalserver.c: Add include of signal.h for SIGPIPE and signal() (#6193)
+
+== Port ==
+ * CPLGetValueType(): improve heuristics to avoid detecting some WKB strings as real numbers (#6128)
+ * Fix CPLGetValueType() to recognize D1 as a string and not a real number (#6305)
+ * /vsistdout/: flush when closing the handle (#6149)
+ * CPLFormFilename(): use '/' directory separator on Windows on /vsicurl_streaming/ files (#6310)
+
+== GDAL Core ==
+ * Fix memory leaks if GDALAllRegister is not called (#6139)
+ * Make private member of GDALDataset really opaque so as to be able to extend it without breaking the C++ ABI (#6163)
+ * Avoid deadlock when writing 2 datasets in 2 threads (#6163)
+ * Block cache: fix excessive memory consumption when dealing with datasets with different block sizes (#6226)
+ * Fix leak in GetMetadataItem() on GDALProxyPoolDataset (#6238)
+ * MDReader: do no attempt reading side-car files on /vsisubfile/ (#6241)
+ * Fix potential buffer overflow in PamHistogramToXMLTree() (#6266)
+
+== GDAL Algorithms ==
+ * Warp: avoid really excessive processing time for some warping with target areas completely off the source raster (especially when involving RPC) (#6182)
+
+== Utilities ==
+ * ogr2ogr: prevent from the gt setting to override transaction group size of 1 set by skipfailures earlier (#2409)
+ * gdalmove.py: fix to run with GDAL 2.0 gdal.InvGeoTransform() signature (#6173)
+ * gdaladdo: emit error message if passed an invalid dataset name (#6240)
+ * gdalwarp: fix -srcnodata to not put garbage values as target dstnodata (#6315)
+
+== GDAL drivers ==
+
+BSB driver:
+ * remove broken and useless logic to deal with extension lines in headers (#6307)
+
+ECRG driver:
+ * fix base34 decoding and Windows filename handling (#6271)
+
+GTiff driver:
+ * [2.0 regression] fix problem with implicit overviews of JPEG-compressed files (#6308)
+ * fix potential memleak in GTiffDataset::GetJPEGOverviewCount() (#6318)
+ * call XTIFFInitialize() in LibgeotiffOneTimeInit() as the former isn't thread-safe, so better call it from the later which is thread-safe (#6163)
+ * fix writing other angular units than degree (namely arc-second, arc-minute, grad, gon and radian) (#6171)
+ * fix reading angular unit value for angular units than degree (#6171)
+ * do not use VirtualMemIO optimization on compressed /vsimem/ files (#6195)
+ * fix DirectIO() mode with complex types and inverted endianness (#6198)
+ * correctly set GTRasterTypeGeoKey=RasterPixelIsPoint if AREA_OR_POINT=Point but there is no SRS set (#6225)
+ * do not read large 'one row' JBIG compressed files with the scanline API (#6264)
+ * fix SetMetadata() to properly clear existing PAM metadata (complement to #5807)
+ * prevent potential out of bounds read to TIFFTAG_EXTRASAMPLES (#6282)
+ * do not use first directory as potential mask, to avoid assertion in GTiffDataset::SetDirectory() (#6287)
+ * reject files with strips/tiles/scanlines bigger than 2 GB to avoid 32 bit integer overflow.
+   Also in case of files with Contig PlanarConfiguration do not make reading one block for band 2 OK when reading for band 1 issued an error (#6288)
+
+GPKG driver:
+ * fix various issues in update scenarios when interacting with the GDAL block cache that could result in lost/corrupted band data to be written in tiles (#6309)
+
+HFA driver:
+ * fix crash when nNumRuns = 0 with RLE compression (#6208)
+ * avoid potential out-of-bounds buffer write (#6286)
+
+KMLSuperoverlay driver:
+ * [2.0 regression] fix errors happening with some RasterIO() requests involving resampling (#6311)
+
+netCDF driver:
+ * fix one byte heap write overflow in NCDFTokenizeArray() (#6231)
+ * fix potential buffer overflows with uses of nc_inq_varname(), nc_inq_attname() and nc_get_att_text() (#6227)
+ * validate that gridmapping:GeoTransform has 6 values (#6244)
+ * NCDFIsGDALVersionGTE(): validate content of NC_GLOBAL#GDAL variable (#6245)
+
+NITF driver:
+ * fix TRE parser to properly deal with variable length items not in first nesting level, such as ENGRDA (not added in nitf_spec.xml in this changeset) (#6285)
+
+PDF driver:
+ * correctly take into account non-meter linear units with OGC BP encoding, and add support for US FOOT (#6292)
+
+PDS driver:
+ * change default values of PDS_SampleProjOffset_Shift and PDS_LineProjOffset_Shift to 0.5 (#5941)
+
+USGSDEM driver:
+ * fix CreateCopy() with VS 2015 (#6257)
+
+VICAR driver:
+ * change PDS_SampleProjOffset_Shift and PDS_LineProjOffset_Shift default values to 0.5 (#5941)
+ * VICARKeywordHandler::Ingest(): fix potential buffer overflows (#6256)
+ * be robust to truncated files (#6321)
+
+VRT driver:
+ * serialize NODATA and NoDataValue items with %.16g, e.g. so as to be able to hold large int32 nodata values (#6151)
+ * VRT raw: don't truncate last figure of ImageOffset if there are left space padding (#6290)
+
+WMS driver:
+ * limit number of zoom levels for ArcGIS MapServer JSon (#6186)
+
+XPM driver:
+ * fix vulnerabilities in reading (#6253)
+
+== OGR core ==
+ * OGRSQL: correctly sort NULL values in first positions (#6155)
+ * OGRLayer::SetIgnoredFields(): properly reset state of non first geometry fields (#6283)
+ * Make OGRLayer::SetSpatialFilter(GetSpatialFilter()) work with non empty spatial filter (#6284)
+ * OGRLayer::Erase(): do not discard input geometries that have no intersection with method layer (#6322)
+ * OGRFeature::SetGeometry()/SetGeometryDirectly(): make it work when passed geometry is the currently installed geometry (#6312)
+
+== OGRSpatialReference == 
+ * morphFromESRI(): map Mercator_Auxiliary_Sphere to EPSG:3857 (#5924)
+ * morphFromESRI(): special case with PROJCS name 'WGS_84_Pseudo_Mercator' (#6134)
+ * OSR C API: fix declarations of OSRSetAxes() and OSRSetWagner(), and add missing OSRSetHOMAC(), OSRSetMercator2SP() and OSRSetTPED() (#6183)
+
+== OGR drivers == 
+
+CSV driver:
+ * Make OGRCSVLayer::CreateGeomField() returns OGRERR_NONE in case of success instead of OGRERR_FAILURE (#6280)
+
+GeoJSON driver:
+ * [2.0 regression] fix crash on null / non-json object features (#6166)
+ * make sure there's enough space to write the FeatureCollection bbox (#6262)
+
+GML driver:
+ * serialize in .gfs file the name of the geometry element when it is 'geometry' since this is a particular case (#6247)
+ * fix logic error in BuildJointClassFromScannedSchema() (#6302)
+ * VFR: fix broken processing VFR ST_UVOH files (#6248)
+ * VFR: fix reading ZpusobOchrany attributes (#6258)
+
+GPX driver:
+ * [2.0 regression] fix crash when parsing a 'time' extension element at route/track level (#6237)
+
+ILI driver:
+ * Support for Surface polygon rings spread over multiple geometry records (#5099)
+
+MITAB driver:
+ * add support for block sizes other than 512 bytes in .map files, for MapInfo 15.2 compatibility (#6298)
+ * read MID files with TAB delimiter and empty first field (#5405)
+ * use projection code 29 when exporting non-Polar Lambert Azimuthal Equal Area (#5220)
+ * fix segfault when parsing a Region 0 (#6273)
+ * TABPolyline::ReadGeometryFromMIFFile(): fix segfaults on invalid geometries (#6273)
+ * TABRectangle::ReadGeometryFromMIFFile(): fix crash on malformed ROUNDRECT (#6273)
+
+MSSQLSpatial driver:
+ * do not treat a primary key that is not of integer type as the FID (#6235)
+
+NTF driver:
+ * fix potential buffer overflows when reading too short lines (#6277)
+
+OpenFileGDB driver:
+ * fix min/max on columns without indices (#6150)
+
+PG driver:
+ * fix memleak in ExecuteSQL() (#6179)
+ * avoid reseting error potentially emitted by ExecuteSQL() (#6194)
+
+PGDump driver:
+ * fix issue with case of ogc_fid field in case the FID layer creation option is not set by user or by ogr2ogr (related to #6232)
+
+Shape driver:
+ * fix REPACK crash on shapefile without .dbf (#6274)
+ * fix crash on MultiLineStringM shapes that have no M component (#6317)
+
+VRT driver:
+ * fix editing with 'direct' geometry mode which could cause attribute column to be empty (#6289)
+
+== SWIG Language Bindings ==
+
+Perl bindings:
+ * Fix incorrect signature in "shadow" feature of Geo::OGR::Feature new (#6181)
+ * Add missing osr.t to MANIFEST. Update Makefile.PL to the one in CPAN version.
+
+Java bindings:
+ * GNUmakefile: add support for all hardening buildflags (#5998)
+
 = GDAL/OGR 2.0.1 Release Notes = 
 
 The 2.0.1 release is a bug fix release.
@@ -84,7 +259,7 @@ VRT driver:
  * EPSGGetPCSInfo(): use pcs.override.csv in priority over pcs.csv to read projection name, UOM, UOMAngle, GeogCS, etc... (#6026)
  * Correctly transform Mercator_2SP and _1SP to ESRI Mercator, and back from ESRI Mercator to Mercator_2SP (#4861)
 
-== OGR Utilities == 
+== OGR drivers == 
 
 CSV driver:
  * Fix issues with leading single quote, and missing first line after ResetReading(), when parsing allCountries.txt (#6087)
diff --git a/VERSION b/VERSION
index 38f77a6..e9307ca 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.0.1
+2.0.2
diff --git a/aclocal.m4 b/aclocal.m4
index 2154260..187c970 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,4 +1,4 @@
-# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
+# generated automatically by aclocal 1.11 -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 # 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
@@ -28,3 +28,4 @@ m4_include([m4/ltoptions.m4])
 m4_include([m4/ltsugar.m4])
 m4_include([m4/ltversion.m4])
 m4_include([m4/lt~obsolete.m4])
+m4_include([m4/pkg.m4])
diff --git a/alg/gdalwarpoperation.cpp b/alg/gdalwarpoperation.cpp
index a150d1a..3d8a9bd 100644
--- a/alg/gdalwarpoperation.cpp
+++ b/alg/gdalwarpoperation.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdalwarpoperation.cpp 28876 2015-04-08 22:21:55Z rouault $
+ * $Id: gdalwarpoperation.cpp 31177 2015-10-28 12:43:31Z rouault $
  *
  * Project:  High Performance Image Reprojector
  * Purpose:  Implementation of the GDALWarpOperation class.
@@ -33,7 +33,7 @@
 #include "cpl_multiproc.h"
 #include "ogr_api.h"
 
-CPL_CVSID("$Id: gdalwarpoperation.cpp 28876 2015-04-08 22:21:55Z rouault $");
+CPL_CVSID("$Id: gdalwarpoperation.cpp 31177 2015-10-28 12:43:31Z rouault $");
 
 struct _GDALWarpChunk { 
     int dx, dy, dsx, dsy; 
@@ -2284,6 +2284,30 @@ CPLErr GDALWarpOperation::ComputeSourceWindow(int nDstXOff, int nDstYOff,
                   nFailedCount, nSamplePoints );
 
 /* -------------------------------------------------------------------- */
+/*   Early exit to avoid crazy values to cause a huge nResWinSize that  */
+/*   would result in a result window wrongly covering the whole raster. */
+/* -------------------------------------------------------------------- */
+    const int nRasterXSize = GDALGetRasterXSize(psOptions->hSrcDS);
+    const int nRasterYSize = GDALGetRasterYSize(psOptions->hSrcDS);
+    if( dfMinXOut > nRasterXSize ||
+        dfMaxXOut < 0 ||
+        dfMinYOut > nRasterYSize ||
+        dfMaxYOut < 0 )
+    {
+        *pnSrcXOff = 0;
+        *pnSrcYOff = 0;
+        *pnSrcXSize = 0;
+        *pnSrcYSize = 0;
+        if( pnSrcXExtraSize )
+            *pnSrcXExtraSize = 0;
+        if( pnSrcYExtraSize )
+            *pnSrcYExtraSize = 0;
+        if( pdfSrcFillRatio )
+            *pdfSrcFillRatio = 0;
+        return CE_None;
+    }
+
+/* -------------------------------------------------------------------- */
 /*      How much of a window around our source pixel might we need      */
 /*      to collect data from based on the resampling kernel?  Even      */
 /*      if the requested central pixel falls off the source image,      */
@@ -2325,8 +2349,8 @@ CPLErr GDALWarpOperation::ComputeSourceWindow(int nDstXOff, int nDstYOff,
     */
     *pnSrcXOff = MAX(0,(int) floor( dfMinXOut ) );
     *pnSrcYOff = MAX(0,(int) floor( dfMinYOut ) );
-    *pnSrcXOff = MIN(*pnSrcXOff,GDALGetRasterXSize(psOptions->hSrcDS));
-    *pnSrcYOff = MIN(*pnSrcYOff,GDALGetRasterYSize(psOptions->hSrcDS));
+    *pnSrcXOff = MIN(*pnSrcXOff,nRasterXSize);
+    *pnSrcYOff = MIN(*pnSrcYOff,nRasterYSize);
 
     double dfCeilMaxXOut = ceil(dfMaxXOut);
     if( dfCeilMaxXOut > INT_MAX )
@@ -2335,21 +2359,21 @@ CPLErr GDALWarpOperation::ComputeSourceWindow(int nDstXOff, int nDstYOff,
     if( dfCeilMaxYOut > INT_MAX )
         dfCeilMaxYOut = INT_MAX;
 
-    int nSrcXSizeRaw = MIN( GDALGetRasterXSize(psOptions->hSrcDS) - *pnSrcXOff,
+    int nSrcXSizeRaw = MIN( nRasterXSize - *pnSrcXOff,
                        ((int) dfCeilMaxXOut) - *pnSrcXOff );
-    int nSrcYSizeRaw = MIN( GDALGetRasterYSize(psOptions->hSrcDS) - *pnSrcYOff,
+    int nSrcYSizeRaw = MIN( nRasterYSize - *pnSrcYOff,
                        ((int) dfCeilMaxYOut) - *pnSrcYOff );
     nSrcXSizeRaw = MAX(0,nSrcXSizeRaw);
     nSrcYSizeRaw = MAX(0,nSrcYSizeRaw);
     
     *pnSrcXOff = MAX(0,(int) floor( dfMinXOut ) - nResWinSize );
     *pnSrcYOff = MAX(0,(int) floor( dfMinYOut ) - nResWinSize );
-    *pnSrcXOff = MIN(*pnSrcXOff,GDALGetRasterXSize(psOptions->hSrcDS));
-    *pnSrcYOff = MIN(*pnSrcYOff,GDALGetRasterYSize(psOptions->hSrcDS));
+    *pnSrcXOff = MIN(*pnSrcXOff,nRasterXSize);
+    *pnSrcYOff = MIN(*pnSrcYOff,nRasterYSize);
 
-    *pnSrcXSize = MIN( GDALGetRasterXSize(psOptions->hSrcDS) - *pnSrcXOff,
+    *pnSrcXSize = MIN( nRasterXSize - *pnSrcXOff,
                        ((int) dfCeilMaxXOut) - *pnSrcXOff + nResWinSize );
-    *pnSrcYSize = MIN( GDALGetRasterYSize(psOptions->hSrcDS) - *pnSrcYOff,
+    *pnSrcYSize = MIN( nRasterYSize - *pnSrcYOff,
                        ((int) dfCeilMaxYOut) - *pnSrcYOff + nResWinSize );
     *pnSrcXSize = MAX(0,*pnSrcXSize);
     *pnSrcYSize = MAX(0,*pnSrcYSize);
diff --git a/apps/gdaladdo.cpp b/apps/gdaladdo.cpp
index 357f7ea..0397785 100644
--- a/apps/gdaladdo.cpp
+++ b/apps/gdaladdo.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdaladdo.cpp 28083 2014-12-05 18:58:42Z rouault $
+ * $Id: gdaladdo.cpp 31759 2015-11-25 15:40:59Z rouault $
  *
  * Project:  GDAL Utilities
  * Purpose:  Commandline application to build overviews. 
@@ -31,7 +31,7 @@
 #include "gdal_priv.h"
 #include "cpl_string.h"
 
-CPL_CVSID("$Id: gdaladdo.cpp 28083 2014-12-05 18:58:42Z rouault $");
+CPL_CVSID("$Id: gdaladdo.cpp 31759 2015-11-25 15:40:59Z rouault $");
 
 /************************************************************************/
 /*                               Usage()                                */
@@ -195,7 +195,7 @@ int main( int nArgc, char ** papszArgv )
     }
 
     if( hDataset == NULL )
-        hDataset = GDALOpenEx( pszFilename, GDAL_OF_RASTER, NULL, papszOpenOptions, NULL );
+        hDataset = GDALOpenEx( pszFilename, GDAL_OF_RASTER | GDAL_OF_VERBOSE_ERROR, NULL, papszOpenOptions, NULL );
 
     CSLDestroy(papszOpenOptions);
     papszOpenOptions = NULL;
diff --git a/apps/gdaldem.cpp b/apps/gdaldem.cpp
index e8bbc6c..8c06acc 100644
--- a/apps/gdaldem.cpp
+++ b/apps/gdaldem.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdaldem.cpp 29623 2015-08-07 20:11:48Z rouault $
+ * $Id: gdaldem.cpp 30887 2015-10-07 15:52:20Z rouault $
  *
  * Project:  GDAL DEM Utilities
  * Purpose:  
@@ -92,7 +92,7 @@
 #include "gdal_priv.h"
 #include "commonutils.h"
 
-CPL_CVSID("$Id: gdaldem.cpp 29623 2015-08-07 20:11:48Z rouault $");
+CPL_CVSID("$Id: gdaldem.cpp 30887 2015-10-07 15:52:20Z rouault $");
 
 #ifndef M_PI
 # define M_PI  3.1415926535897932384626433832795
diff --git a/apps/gdalserver.c b/apps/gdalserver.c
index a27614c..20aabb5 100644
--- a/apps/gdalserver.c
+++ b/apps/gdalserver.c
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdalserver.c 29668 2015-08-19 16:41:53Z rouault $
+ * $Id: gdalserver.c 31326 2015-11-02 20:26:23Z rouault $
  *
  * Project:  GDAL
  * Purpose:  Server application that is forked by libgdal
@@ -50,6 +50,7 @@
   #include <sys/socket.h>
   #include <sys/un.h>
   #include <netinet/in.h>
+  #include <signal.h>
   #include <unistd.h>
   #ifdef HAVE_GETADDRINFO
     #include <netdb.h>
@@ -76,7 +77,7 @@ int CPL_DLL GDALServerLoop(CPL_FILE_HANDLE fin, CPL_FILE_HANDLE fout);
 int CPL_DLL GDALServerLoopSocket(CPL_SOCKET nSocket);
 CPL_C_END
 
-CPL_CVSID("$Id: gdalserver.c 29668 2015-08-19 16:41:53Z rouault $");
+CPL_CVSID("$Id: gdalserver.c 31326 2015-11-02 20:26:23Z rouault $");
 
 /************************************************************************/
 /*                               Usage()                                */
diff --git a/apps/gdalwarp.cpp b/apps/gdalwarp.cpp
index 434618c..867152f 100644
--- a/apps/gdalwarp.cpp
+++ b/apps/gdalwarp.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdalwarp.cpp 29153 2015-05-04 17:51:41Z rouault $
+ * $Id: gdalwarp.cpp 33043 2016-01-19 10:00:20Z rouault $
  *
  * Project:  High Performance Image Reprojector
  * Purpose:  Test program for high performance warper API.
@@ -37,7 +37,7 @@
 #include "gdal_priv.h"
 #include <vector>
 
-CPL_CVSID("$Id: gdalwarp.cpp 29153 2015-05-04 17:51:41Z rouault $");
+CPL_CVSID("$Id: gdalwarp.cpp 33043 2016-01-19 10:00:20Z rouault $");
 
 static void
 LoadCutline( const char *pszCutlineDSName, const char *pszCLayer, 
@@ -1792,19 +1792,10 @@ int main( int argc, char ** argv )
 
             for( i = 0; i < psWO->nBandCount; i++ )
             {
-                int bHaveNodata = FALSE;
-                
-                GDALRasterBandH hBand = GDALGetRasterBand( hWrkSrcDS, i+1 );
-                GDALGetRasterNoDataValue( hBand, &bHaveNodata );
-
-                CPLDebug("WARP", "band=%d bHaveNodata=%d", i, bHaveNodata);
-                if( bHaveNodata )
-                {
-                    psWO->padfDstNoDataReal[i] = psWO->padfSrcNoDataReal[i];
-                    psWO->padfDstNoDataImag[i] = psWO->padfSrcNoDataImag[i];
-                    CPLDebug("WARP", "srcNoData=%f dstNoData=%f", 
-                             psWO->padfSrcNoDataReal[i], psWO->padfDstNoDataReal[i] );
-                }
+                psWO->padfDstNoDataReal[i] = psWO->padfSrcNoDataReal[i];
+                psWO->padfDstNoDataImag[i] = psWO->padfSrcNoDataImag[i];
+                CPLDebug("WARP", "srcNoData=%f dstNoData=%f", 
+                            psWO->padfSrcNoDataReal[i], psWO->padfDstNoDataReal[i] );
 
                 if( bCreateOutput )
                 {
diff --git a/apps/ogr2ogr.cpp b/apps/ogr2ogr.cpp
index b9a824c..6905913 100644
--- a/apps/ogr2ogr.cpp
+++ b/apps/ogr2ogr.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogr2ogr.cpp 29251 2015-05-25 21:24:45Z rouault $
+ * $Id: ogr2ogr.cpp 30691 2015-09-24 18:00:57Z tamas $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Simple client for translating between formats.
@@ -39,7 +39,7 @@
 #include <map>
 #include <vector>
 
-CPL_CVSID("$Id: ogr2ogr.cpp 29251 2015-05-25 21:24:45Z rouault $");
+CPL_CVSID("$Id: ogr2ogr.cpp 30691 2015-09-24 18:00:57Z tamas $");
 
 static int bSkipFailures = FALSE;
 static int bLayerTransaction = -1;
@@ -1189,10 +1189,15 @@ int main( int nArgc, char ** papszArgv )
         {
             CHECK_HAS_ENOUGH_ADDITIONAL_ARGS(1);
             ++iArg;
-            if( EQUAL(papszArgv[iArg], "unlimited") )
-                nGroupTransactions = -1;
-            else
-                nGroupTransactions = atoi(papszArgv[iArg]);
+            /* If skipfailures is already set we should not
+            modify nGroupTransactions = 1  #2409 */
+            if ( !bSkipFailures )
+            {
+                if( EQUAL(papszArgv[iArg], "unlimited") )
+                    nGroupTransactions = -1;
+                else
+                    nGroupTransactions = atoi(papszArgv[iArg]);
+            }
         }
         else if ( EQUAL(papszArgv[iArg],"-ds_transaction") )
         {
diff --git a/configure b/configure
index e03e625..4ab3303 100755
--- a/configure
+++ b/configure
@@ -705,9 +705,12 @@ HAVE_OCI
 ODBC_SETTING
 LIBKML_INCLUDE
 HAVE_LIBKML
-LIBKML_VERSION
 LIBKML_LDFLAGS
+LIBKML_VERSION
+LIBKML_LDLAGS
+LIBKML_LIBS
 LIBKML_CFLAGS
+PKG_CONFIG
 EXPAT_INCLUDE
 HAVE_EXPAT
 EXPAT_VERSION
@@ -1014,7 +1017,10 @@ CXX
 CXXFLAGS
 CCC
 CPP
-CXXCPP'
+CXXCPP
+PKG_CONFIG
+LIBKML_CFLAGS
+LIBKML_LIBS'
 
 
 # Initialize some variables set by options.
@@ -1763,6 +1769,10 @@ Some influential environment variables:
   CXXFLAGS    C++ compiler flags
   CPP         C preprocessor
   CXXCPP      C++ preprocessor
+  PKG_CONFIG  path to pkg-config utility
+  LIBKML_CFLAGS
+              C compiler flags for LIBKML, overriding pkg-config
+  LIBKML_LIBS linker flags for LIBKML, overriding pkg-config
 
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
@@ -24574,50 +24584,263 @@ else
 fi
 
 
-    LIBKML_CFLAGS=""
-    LIBKML_LDFLAGS=""
-    LIBKML_VERSION=""
 
-                run_libkml_test="no"
 
-    if test -n "$libkml_prefix"; then
-        libkml_include_dir="$libkml_prefix/include"
-        libkml_include_dir2="$libkml_prefix/include/kml"
-        libkml_include_dir3="$libkml_prefix/include/kml/third_party/boost_1_34_1"
-        if test "$libkml_prefix" = "/usr"; then
-            libkml_lib_flags="-lkmldom -lkmlbase -lkmlengine -lkmlconvenience -lminizip -luriparser"
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+	if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_PKG_CONFIG+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_PKG_CONFIG"; then
+  ac_pt_PKG_CONFIG=$PKG_CONFIG
+  # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $ac_pt_PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
+if test -n "$ac_pt_PKG_CONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
+$as_echo "$ac_pt_PKG_CONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_pt_PKG_CONFIG" = x; then
+    PKG_CONFIG=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    PKG_CONFIG=$ac_pt_PKG_CONFIG
+  fi
+else
+  PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
+fi
+
+fi
+if test -n "$PKG_CONFIG"; then
+	_pkg_min_version=0.25
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
+$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
+	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+		{ $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; }
+		PKG_CONFIG=""
+	fi
+
+fi # check and set $PKG_CONFIG
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBKML" >&5
+$as_echo_n "checking for LIBKML... " >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$LIBKML_CFLAGS"; then
+        pkg_cv_LIBKML_CFLAGS="$LIBKML_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libkml >= \$LIBKML_REQ_VERSION\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libkml >= $LIBKML_REQ_VERSION") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_LIBKML_CFLAGS=`$PKG_CONFIG --cflags "libkml >= $LIBKML_REQ_VERSION" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$LIBKML_LIBS"; then
+        pkg_cv_LIBKML_LIBS="$LIBKML_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libkml >= \$LIBKML_REQ_VERSION\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libkml >= $LIBKML_REQ_VERSION") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_LIBKML_LIBS=`$PKG_CONFIG --libs "libkml >= $LIBKML_REQ_VERSION" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+	        LIBKML_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libkml >= $LIBKML_REQ_VERSION"`
         else
-            libkml_lib_flags="-L$libkml_prefix/lib -lkmldom -lkmlbase -lkmlengine -lkmlconvenience -lminizip -luriparser"
+	        LIBKML_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libkml >= $LIBKML_REQ_VERSION"`
         fi
-        run_libkml_test="yes"
-    elif test "$libkml_requested" = "yes"; then
-        if test -n "$libkml_include_dir" -a -n "$libkml_lib_flags"; then
-            libkml_include_dir2="$libkml_include_dir/kml"
-            libkml_include_dir3="$libkml_include_dir/kml/third_party/boost_1_34_1"
+	# Put the nasty error message in config.log where it belongs
+	echo "$LIBKML_PKG_ERRORS" >&5
+
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+                LIBKML_VERSION=;
+elif test $pkg_failed = untried; then
+	LIBKML_VERSION=;
+else
+	LIBKML_CFLAGS=$pkg_cv_LIBKML_CFLAGS
+	LIBKML_LIBS=$pkg_cv_LIBKML_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+	LIBKML_VERSION=`$PKG_CONFIG --modversion libkml`
+fi
+
+    if test -n "$LIBKML_VERSION" -a -n "$libkml_prefix"; then
+        HAVE_LIBKML="yes"
+
+	LIBKML_LDFLAGS="$LIBKML_LIBS"
+
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBKML CFLAGS" >&5
+$as_echo_n "checking for LIBKML CFLAGS... " >&6; }
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBKML_CFLAGS" >&5
+$as_echo "$LIBKML_CFLAGS" >&6; }
+
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBKML LDFLAGS" >&5
+$as_echo_n "checking for LIBKML LDFLAGS... " >&6; }
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBKML_LDFLAGS" >&5
+$as_echo "$LIBKML_LDFLAGS" >&6; }
+
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBKML VERSION" >&5
+$as_echo_n "checking for LIBKML VERSION... " >&6; }
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBKML_VERSION" >&5
+$as_echo "$LIBKML_VERSION" >&6; }
+
+
+
+
+    else
+        LIBKML_CFLAGS=""
+        LIBKML_LDFLAGS=""
+        LIBKML_VERSION=""
+
+                                run_libkml_test="no"
+
+        if test -n "$libkml_prefix"; then
+            libkml_include_dir="$libkml_prefix/include"
+            libkml_include_dir2="$libkml_prefix/include/kml"
+            libkml_include_dir3="$libkml_prefix/include/kml/third_party/boost_1_34_1"
+            if test "$libkml_prefix" = "/usr"; then
+                libkml_lib_flags="-lkmldom -lkmlbase -lkmlengine -lkmlconvenience -lminizip -luriparser"
+            else
+                libkml_lib_flags="-L$libkml_prefix/lib -lkmldom -lkmlbase -lkmlengine -lkmlconvenience -lminizip -luriparser"
+            fi
             run_libkml_test="yes"
+        elif test "$libkml_requested" = "yes"; then
+            if test -n "$libkml_include_dir" -a -n "$libkml_lib_flags"; then
+                libkml_include_dir2="$libkml_include_dir/kml"
+                libkml_include_dir3="$libkml_include_dir/kml/third_party/boost_1_34_1"
+                run_libkml_test="yes"
+            fi
+        else
+            run_libkml_test="no"
         fi
-    else
-        run_libkml_test="no"
-    fi
 
-                if test "$run_libkml_test" = "yes"; then
+                                if test "$run_libkml_test" = "yes"; then
 
-        saved_CPPFLAGS="$CPPFLAGS"
-        CPPFLAGS="$CPPFLAGS -I$libkml_include_dir -I$libkml_include_dir2 -I$libkml_include_dir3"
+            saved_CPPFLAGS="$CPPFLAGS"
+            CPPFLAGS="$CPPFLAGS -I$libkml_include_dir -I$libkml_include_dir2 -I$libkml_include_dir3"
 
-        saved_LIBS="$LIBS"
-        LIBS="$LIBS $libkml_lib_flags"
+            saved_LIBS="$LIBS"
+            LIBS="$LIBS $libkml_lib_flags"
 
-                                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Google libkml headers in $libkml_include_dir, $libkml_include_dir2, and $libkml_include_dir3" >&5
+                                                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Google libkml headers in $libkml_include_dir, $libkml_include_dir2, and $libkml_include_dir3" >&5
 $as_echo_n "checking for Google libkml headers in $libkml_include_dir, $libkml_include_dir2, and $libkml_include_dir3... " >&6; }
 
-        ac_ext=cpp
+            ac_ext=cpp
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
-        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 
@@ -24634,39 +24857,39 @@ main ()
 _ACEOF
 if ac_fn_cxx_try_compile "$LINENO"; then :
 
-            LIBKML_CFLAGS="-I$libkml_include_dir -I$libkml_include_dir2 -I$libkml_include_dir3"
-            libkml_header_found="yes"
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
+                LIBKML_CFLAGS="-I$libkml_include_dir -I$libkml_include_dir2 -I$libkml_include_dir3"
+                libkml_header_found="yes"
+                { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
 $as_echo "found" >&6; }
 
 else
 
-            libkml_header_found="no"
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+                libkml_header_found="no"
+                { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
 $as_echo "not found" >&6; }
 
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-        ac_ext=c
+            ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-                                if test "$libkml_header_found" = "yes"; then
+                                                if test "$libkml_header_found" = "yes"; then
 
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Google libkml libraries" >&5
+                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Google libkml libraries" >&5
 $as_echo_n "checking for Google libkml libraries... " >&6; }
 
-            ac_ext=cpp
+                ac_ext=cpp
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
-            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+                cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 
@@ -24685,114 +24908,115 @@ kmldom::KmlFactory* factory = kmldom::KmlFactory::GetFactory();
 _ACEOF
 if ac_fn_cxx_try_link "$LINENO"; then :
 
-                LIBKML_LDFLAGS="$libkml_lib_flags"
-                libkml_lib_found="yes"
-                { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
+                    LIBKML_LDFLAGS="$libkml_lib_flags"
+                    libkml_lib_found="yes"
+                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
 $as_echo "found" >&6; }
 
 else
 
-                libkml_lib_found="no"
-                { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+                    libkml_lib_found="no"
+                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
 $as_echo "not found" >&6; }
 
 
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-            ac_ext=c
+                ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-        fi
+            fi
 
-        CPPFLAGS="$saved_CPPFLAGS"
-        LIBS="$saved_LIBS"
-    fi
+            CPPFLAGS="$saved_CPPFLAGS"
+            LIBS="$saved_LIBS"
+        fi
 
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Google libkml" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Google libkml" >&5
 $as_echo_n "checking for Google libkml... " >&6; }
 
-    if test "$run_libkml_test" = "yes"; then
-        if test "$libkml_header_found" = "yes" -a "$libkml_lib_found" = "yes"; then
+        if test "$run_libkml_test" = "yes"; then
+            if test "$libkml_header_found" = "yes" -a "$libkml_lib_found" = "yes"; then
 
 
 
 
-            HAVE_LIBKML="yes"
-        else
-            HAVE_LIBKML="no"
-        fi
+                HAVE_LIBKML="yes"
+            else
+                HAVE_LIBKML="no"
+            fi
 
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_LIBKML" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_LIBKML" >&5
 $as_echo "$HAVE_LIBKML" >&6; }
 
-                                if test "$HAVE_LIBKML" = "yes"; then
+                                                if test "$HAVE_LIBKML" = "yes"; then
 
-            libkml_version_req=$LIBKML_REQ_VERSION
+                libkml_version_req=$LIBKML_REQ_VERSION
 
-            if test  -n "$libkml_version_req"; then
+                if test  -n "$libkml_version_req"; then
 
-                { $as_echo "$as_me:${as_lineno-$LINENO}: checking if Google libkml version is >= $libkml_version_req" >&5
+                    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if Google libkml version is >= $libkml_version_req" >&5
 $as_echo_n "checking if Google libkml version is >= $libkml_version_req... " >&6; }
 
-                if test -f "$libkml_include_dir2/base/version.h"; then
+                    if test -f "$libkml_include_dir2/base/version.h"; then
 
-                    libkml_major=$(sed -n '/^#define LIBKML_MAJOR_VERSION.*$/{s/\([^0-9]*\)\([0-9]*\).*/\2/;P;}' \
-		    	$libkml_include_dir2/base/version.h)
-                    libkml_minor=$(sed -n '/^#define LIBKML_MINOR_VERSION.*$/{s/\([^0-9]*\)\([0-9]*\).*/\2/;P;}' \
-		    	$libkml_include_dir2/base/version.h)
-                    libkml_revision=$(sed -n '/^#define LIBKML_MICRO_VERSION.*$/{s/\([^0-9]*\)\([0-9]*\).*/\2/;P;}' \
-		    	$libkml_include_dir2/base/version.h)
+                        libkml_major=$(sed -n '/^#define LIBKML_MAJOR_VERSION.*$/{s/\([^0-9]*\)\([0-9]*\).*/\2/;P;}' \
+                            $libkml_include_dir2/base/version.h)
+                        libkml_minor=$(sed -n '/^#define LIBKML_MINOR_VERSION.*$/{s/\([^0-9]*\)\([0-9]*\).*/\2/;P;}' \
+                            $libkml_include_dir2/base/version.h)
+                        libkml_revision=$(sed -n '/^#define LIBKML_MICRO_VERSION.*$/{s/\([^0-9]*\)\([0-9]*\).*/\2/;P;}' \
+                            $libkml_include_dir2/base/version.h)
 
-                    LIBKML_VERSION="$libkml_major.$libkml_minor.$libkml_revision"
+                        LIBKML_VERSION="$libkml_major.$libkml_minor.$libkml_revision"
 
 
-                                        libkml_version_req_major=`expr $libkml_version_req : '\([0-9]*\)'`
-                    libkml_version_req_minor=`expr $libkml_version_req : '[0-9]*\.\([0-9]*\)'`
-                    libkml_version_req_revision=`expr $libkml_version_req : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
-                    if test "x$libkml_version_req_revision" = "x"; then
-                        libkml_version_req_revision="0"
-                    fi
+                                                libkml_version_req_major=`expr $libkml_version_req : '\([0-9]*\)'`
+                        libkml_version_req_minor=`expr $libkml_version_req : '[0-9]*\.\([0-9]*\)'`
+                        libkml_version_req_revision=`expr $libkml_version_req : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
+                        if test "x$libkml_version_req_revision" = "x"; then
+                            libkml_version_req_revision="0"
+                        fi
 
-                    libkml_version_req_number=`expr $libkml_version_req_major \* 10000 \
-                                               \+ $libkml_version_req_minor \* 100 \
-                                               \+ $libkml_version_req_revision`
+                        libkml_version_req_number=`expr $libkml_version_req_major \* 10000 \
+                                                   \+ $libkml_version_req_minor \* 100 \
+                                                   \+ $libkml_version_req_revision`
 
-                                        libkml_version_number=`expr $libkml_major \* 10000 \
-                                          \+ $libkml_minor \* 100 \
-                                           \+ $libkml_revision`
+                                                libkml_version_number=`expr $libkml_major \* 10000 \
+                                              \+ $libkml_minor \* 100 \
+                                               \+ $libkml_revision`
 
-                    libkml_version_check=`expr $libkml_version_number \>\= $libkml_version_req_number`
-                    if test "$libkml_version_check" = "1"; then
-                        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+                        libkml_version_check=`expr $libkml_version_number \>\= $libkml_version_req_number`
+                        if test "$libkml_version_check" = "1"; then
+                            { $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
+                        else
+                            { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-                        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Found Google libkml ${LIBKML_VERSION}, which is older than required (${libkml_version_req}). KML support disabled." >&5
+                            { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Found Google libkml ${LIBKML_VERSION}, which is older than required (${libkml_version_req}). KML support disabled." >&5
 $as_echo "$as_me: WARNING: Found Google libkml ${LIBKML_VERSION}, which is older than required (${libkml_version_req}). KML support disabled." >&2;}
-			HAVE_LIBKML="no"
-                    fi
-                else
-                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+                            HAVE_LIBKML="no"
+                        fi
+                    else
+                        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-                    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Missing header $libkml_include_dir2/base/bersion.hpp. Unable to determine Google libkml version." >&5
+                        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Missing header $libkml_include_dir2/base/bersion.hpp. Unable to determine Google libkml version." >&5
 $as_echo "$as_me: WARNING: Missing header $libkml_include_dir2/base/bersion.hpp. Unable to determine Google libkml version." >&2;}
+                    fi
                 fi
             fi
-        fi
 
-    else
-        HAVE_LIBKML="no"
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_LIBKML" >&5
+        else
+            HAVE_LIBKML="no"
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_LIBKML" >&5
 $as_echo "$HAVE_LIBKML" >&6; }
 
-        if test "$libkml_requested" = "yes"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Google libkml support requested but headers or library not found. Specify valid prefix of libkml using --with-libkml=[DIR] or provide include directory and linker flags using --with-libkml-inc and --with-libkml-lib" >&5
+            if test "$libkml_requested" = "yes"; then
+                { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Google libkml support requested but headers or library not found. Specify valid prefix of libkml using --with-libkml=[DIR] or provide include directory and linker flags using --with-libkml-inc and --with-libkml-lib" >&5
 $as_echo "$as_me: WARNING: Google libkml support requested but headers or library not found. Specify valid prefix of libkml using --with-libkml=[DIR] or provide include directory and linker flags using --with-libkml-inc and --with-libkml-lib" >&2;}
+            fi
         fi
     fi
 
diff --git a/data/gml_registry.xml b/data/gml_registry.xml
index 0efa105..f4f5a2a 100644
--- a/data/gml_registry.xml
+++ b/data/gml_registry.xml
@@ -49,7 +49,7 @@
                      gfsSchemaLocation="ruian_vf_st_v1.gfs" />
     </namespace>
     <namespace prefix="vf"
-               uri="urn:cz:isvs:ruian:schemas:SpecialniVymennyFormatTypy:v1 SpecialniVymennyFormatTypy.xsd"
+               uri="urn:cz:isvs:ruian:schemas:SpecialniVymennyFormatTypy:v1 ../ruian/xsd/vymenny_format/SpecialniVymennyFormatTypy.xsd"
                useGlobalSRSName="true">
         <featureType elementName="TypSouboru"
                      elementValue="ST_UVOH"
diff --git a/data/ruian_vf_ob_v1.gfs b/data/ruian_vf_ob_v1.gfs
index a64bf86..4b6328e 100644
--- a/data/ruian_vf_ob_v1.gfs
+++ b/data/ruian_vf_ob_v1.gfs
@@ -996,25 +996,25 @@
     <PropertyDefn>
       <Name>ZpusobOchranyKod</Name>
       <ElementPath>ZpusobyOchranyPozemku|ZpusobOchrany|Kod</ElementPath>
-      <Type>Integer</Type>
+      <Type>IntegerList</Type>
     </PropertyDefn>
     <!-- Způsob ochrany pozemku - typ ochrany -->
     <PropertyDefn>
       <Name>ZpusobOchranyTypOchranyKod</Name>
       <ElementPath>ZpusobyOchranyPozemku|ZpusobOchrany|TypOchranyKod</ElementPath>
-      <Type>Integer</Type>
+      <Type>IntegerList</Type>
     </PropertyDefn>
         <!-- Způsob ochrany pozemku - ID transakce v RUIAN -->
     <PropertyDefn>
       <Name>ZpusobOchranyIdTransakce</Name>
       <ElementPath>ZpusobyOchranyPozemku|ZpusobOchrany|IdTransakce</ElementPath>
-      <Type>Integer</Type>
+      <Type>IntegerList</Type>
     </PropertyDefn>
     <!-- Způsob ochrany pozemku - ID řízení v ISKN -->
     <PropertyDefn>
       <Name>ZpusobOchranyRizeniId</Name>
       <ElementPath>ZpusobyOchranyPozemku|ZpusobOchrany|RizeniId</ElementPath>
-      <Type>Integer</Type>
+      <Type>IntegerList</Type>
       <SubType>Integer64</SubType>
     </PropertyDefn>
   </GMLFeatureClass>
@@ -1058,7 +1058,7 @@
     <PropertyDefn>
       <Name>CisloDomovni</Name>
       <ElementPath>CislaDomovni|CisloDomovni</ElementPath>
-      <Type>Integer</Type>
+      <Type>IntegerList</Type>
     </PropertyDefn>
     <!-- Jedna z parcel, na nichž je stavební objekt postaven, zvolená
          pro identifikaci objektu (tzv. definiční parcela) -->
@@ -1203,32 +1203,94 @@
     <!-- Způsob ochrany stavebního objektu - kód ochrany -->
     <PropertyDefn>
       <Name>ZpusobOchranyKod</Name>
-      <ElementPath>ZpusobyOchranyPozemku|ZpusobOchrany|Kod</ElementPath>
-      <Type>Integer</Type>
+      <ElementPath>ZpusobyOchrany|ZpusobOchrany|Kod</ElementPath>
+      <Type>IntegerList</Type>
     </PropertyDefn>
     <!-- Způsob ochrany stavebního objektu - typ ochrany -->
     <PropertyDefn>
       <Name>ZpusobOchranyTypOchranyKod</Name>
-      <ElementPath>ZpusobyOchrany|TypOchranyKod</ElementPath>
-      <Type>Integer</Type>
+      <ElementPath>ZpusobyOchrany|ZpusobOchrany|TypOchranyKod</ElementPath>
+      <Type>IntegerList</Type>
     </PropertyDefn>
     <!-- Způsob ochrany stavebního objektu - ID transakce v RUIAN -->
     <PropertyDefn>
       <Name>ZpusobOchranyIdTransakce</Name>
-      <ElementPath>ZpusobyOchrany|IdTransakce</ElementPath>
-      <Type>Integer</Type>
+      <ElementPath>ZpusobyOchrany|ZpusobOchrany|IdTransakce</ElementPath>
+      <Type>IntegerList</Type>
     </PropertyDefn>
     <!-- Způsob ochrany stavebního objektu - ID řízení v ISKN -->
     <PropertyDefn>
       <Name>ZpusobOchranyRizeniId</Name>
-      <ElementPath>ZpusobyOchrany|RizeniId</ElementPath>
-      <Type>Integer</Type>
+      <ElementPath>ZpusobyOchrany|ZpusobOchrany|RizeniId</ElementPath>
+      <Type>IntegerList</Type>
       <SubType>Integer64</SubType>
     </PropertyDefn>
-    <!-- Detailní tecnicko-ekonomické atributy (TEA) -->
+    <!-- Detailní technicko-ekonomické atributy (TEA) -->
     <PropertyDefn>
       <Name>DetailniTEAKod</Name>
-      <ElementPath>DetailniTEA|Kod</ElementPath>
+      <ElementPath>DetailniTEA|DetailniTEA|Kod</ElementPath>
+      <Type>IntegerList</Type>
+    </PropertyDefn>
+    <!-- TEA - Začátek platnosti -->
+    <PropertyDefn>
+      <Name>DetailniTEAPlatiOd</Name>
+      <ElementPath>DetailniTEA|DetailniTEA|PlatiOd</ElementPath>
+      <Type>StringList</Type>
+      <Width>19</Width>
+    </PropertyDefn>
+    <!-- TEA - ID návrhu změny v ISUI -->
+    <PropertyDefn>
+      <Name>DetailniTEAGlobalniIdNavrhuZmeny</Name>
+      <ElementPath>DetailniTEA|DetailniTEA|GlobalniIdNavrhuZmeny</ElementPath>
+      <Type>IntegerList</Type>
+      <SubType>Integer64</SubType>
+    </PropertyDefn>
+    <!-- TEA - Druh svislé nosné konstrukce -->
+    <PropertyDefn>
+      <Name>DetailniTEADruhKonstrukceKod</Name>
+      <ElementPath>DetailniTEA|DetailniTEA|DruhKonstrukceKod</ElementPath>
+      <Type>IntegerList</Type>
+    </PropertyDefn>
+    <!-- TEA - Počet bytů u stavebního objektu s byty -->
+    <PropertyDefn>
+      <Name>DetailniTEAPocetBytu</Name>
+      <ElementPath>DetailniTEA|DetailniTEA|PocetBytu</ElementPath>
+      <Type>IntegerList</Type>
+    </PropertyDefn>
+    <!-- TEA - Počet nadzemních a podzemních podlaží -->
+    <PropertyDefn>
+      <Name>DetailniTEAPocetPodlazi</Name>
+      <ElementPath>DetailniTEA|DetailniTEA|PocetPodlazi</ElementPath>
+      <Type>IntegerList</Type>
+    </PropertyDefn>
+    <!-- TEA - Připojení na kanalizační síť -->
+    <PropertyDefn>
+      <Name>DetailniTEAPripojeniKanalizaceKod</Name>
+      <ElementPath>DetailniTEA|DetailniTEA|PripojeniKanalizaceKod</ElementPath>
+      <Type>IntegerList</Type>
+    </PropertyDefn>
+    <!-- TEA - Připojení na rozvod plynu -->
+    <PropertyDefn>
+      <Name>DetailniTEAPripojeniPlynKod</Name>
+      <ElementPath>DetailniTEA|DetailniTEA|PripojeniPlynKod</ElementPath>
+      <Type>IntegerList</Type>
+    </PropertyDefn>
+    <!-- TEA - Připojení na vodovod -->
+    <PropertyDefn>
+      <Name>DetailniTEAPripojeniVodovodKod</Name>
+      <ElementPath>DetailniTEA|DetailniTEA|PripojeniVodovodKod</ElementPath>
+      <Type>IntegerList</Type>
+    </PropertyDefn>
+    <!-- TEA - Vybavení výtahem -->
+    <PropertyDefn>
+      <Name>DetailniTEAZpusobVytapeniKod</Name>
+      <ElementPath>DetailniTEA|DetailniTEA|ZpusobVytapeniKod</ElementPath>
+      <Type>IntegerList</Type>
+    </PropertyDefn>
+    <!-- TEA - Kód adresního místa -->
+    <PropertyDefn>
+      <Name>DetailniTEAAdresniMistoKod</Name>
+      <ElementPath>DetailniTEA|DetailniTEA|AdresniMistoKod|Kod</ElementPath>
       <Type>IntegerList</Type>
     </PropertyDefn>
   </GMLFeatureClass>
diff --git a/data/ruian_vf_v1.gfs b/data/ruian_vf_v1.gfs
index 49c36cd..2371925 100644
--- a/data/ruian_vf_v1.gfs
+++ b/data/ruian_vf_v1.gfs
@@ -1592,25 +1592,25 @@
     <PropertyDefn>
       <Name>ZpusobOchranyKod</Name>
       <ElementPath>ZpusobyOchranyPozemku|ZpusobOchrany|Kod</ElementPath>
-      <Type>Integer</Type>
+      <Type>IntegerList</Type>
     </PropertyDefn>
     <!-- Způsob ochrany pozemku - typ ochrany -->
     <PropertyDefn>
       <Name>ZpusobOchranyTypOchranyKod</Name>
       <ElementPath>ZpusobyOchranyPozemku|ZpusobOchrany|TypOchranyKod</ElementPath>
-      <Type>Integer</Type>
+      <Type>IntegerList</Type>
     </PropertyDefn>
         <!-- Způsob ochrany pozemku - ID transakce v RUIAN -->
     <PropertyDefn>
       <Name>ZpusobOchranyIdTransakce</Name>
       <ElementPath>ZpusobyOchranyPozemku|ZpusobOchrany|IdTransakce</ElementPath>
-      <Type>Integer</Type>
+      <Type>IntegerList</Type>
     </PropertyDefn>
     <!-- Způsob ochrany pozemku - ID řízení v ISKN -->
     <PropertyDefn>
       <Name>ZpusobOchranyRizeniId</Name>
       <ElementPath>ZpusobyOchranyPozemku|ZpusobOchrany|RizeniId</ElementPath>
-      <Type>Integer</Type>
+      <Type>IntegerList</Type>
       <SubType>Integer64</SubType>
     </PropertyDefn>
   </GMLFeatureClass>
@@ -1654,7 +1654,7 @@
     <PropertyDefn>
       <Name>CisloDomovni</Name>
       <ElementPath>CislaDomovni|CisloDomovni</ElementPath>
-      <Type>Integer</Type>
+      <Type>IntegerList</Type>
     </PropertyDefn>
     <!-- Jedna z parcel, na nichž je stavební objekt postaven, zvolená
          pro identifikaci objektu (tzv. definiční parcela) -->
@@ -1799,26 +1799,26 @@
     <!-- Způsob ochrany stavebního objektu - kód ochrany -->
     <PropertyDefn>
       <Name>ZpusobOchranyKod</Name>
-      <ElementPath>ZpusobyOchranyPozemku|ZpusobOchrany|Kod</ElementPath>
-      <Type>Integer</Type>
+      <ElementPath>ZpusobyOchrany|ZpusobOchrany|Kod</ElementPath>
+      <Type>IntegerList</Type>
     </PropertyDefn>
     <!-- Způsob ochrany stavebního objektu - typ ochrany -->
     <PropertyDefn>
       <Name>ZpusobOchranyTypOchranyKod</Name>
-      <ElementPath>ZpusobyOchrany|TypOchranyKod</ElementPath>
-      <Type>Integer</Type>
+      <ElementPath>ZpusobyOchrany|ZpusobOchrany|TypOchranyKod</ElementPath>
+      <Type>IntegerList</Type>
     </PropertyDefn>
     <!-- Způsob ochrany stavebního objektu - ID transakce v RUIAN -->
     <PropertyDefn>
       <Name>ZpusobOchranyIdTransakce</Name>
-      <ElementPath>ZpusobyOchrany|IdTransakce</ElementPath>
-      <Type>Integer</Type>
+      <ElementPath>ZpusobyOchrany|ZpusobOchrany|IdTransakce</ElementPath>
+      <Type>IntegerList</Type>
     </PropertyDefn>
     <!-- Způsob ochrany stavebního objektu - ID řízení v ISKN -->
     <PropertyDefn>
       <Name>ZpusobOchranyRizeniId</Name>
-      <ElementPath>ZpusobyOchrany|RizeniId</ElementPath>
-      <Type>Integer</Type>
+      <ElementPath>ZpusobyOchrany|ZpusobOchrany|RizeniId</ElementPath>
+      <Type>IntegerList</Type>
       <SubType>Integer64</SubType>
     </PropertyDefn>
     <!-- Detailní tecnicko-ekonomické atributy (TEA) -->
diff --git a/dist_docs/README_UNX_BIN.TXT b/dist_docs/README_UNX_BIN.TXT
new file mode 100644
index 0000000..f6513c1
--- /dev/null
+++ b/dist_docs/README_UNX_BIN.TXT
@@ -0,0 +1,71 @@
+
+		GDAL/OGR Binary Release
+		=======================
+
+This is a release of GDAL/OGR libraries and related utilities.  Full
+information on GDAL and OGR can be found at:
+
+  http://www.remotesensing.org/gdal                (GDAL)
+  http://gdal.velocet.ca/projects/opengis          (OGR)
+
+Details on the utility programs in this package can be found specifically at:
+
+  http://www.remotesensing.org/gdal/gdal_utilities.html
+  http://gdal.velocet.ca/projets/opengis/ogrhtml/ogr_utilities.html
+
+
+Installing GDAL/OGR
+-------------------
+
+The install_unx.sh script can be used to install GDAL into an existing
+file system tree such as /usr/local or /usr.  It assumes that the 
+$PREFIX/bin directory will already be in the user path, and that 
+$PREFIX/lib is already in the LD_LIBRARY_PATH or configured for ldconfig.
+If ldconfig is used it may be necessary to rerun ldconfig as root. 
+
+To install:
+
+ ./install_unx.sh /usr/local
+
+Note that html documentation and python files are not installed.  Only the
+shared library, binaries and shared data files are installed into
+$PREFIX/lib, $PREFIX/bin and $PREFIX/share/gdal respectively.
+
+After installation the "gdalinfo --version" command can be used to determine
+if the installation was successful.  Then use "gdal_translate --version"
+to verify that the shared libraries are being found properly.  If not
+add $PREFIX/lib to the LD_LIBRARY_PATH or rerun ldconfig as appropriate
+to local usage and the platform in question. 
+
+
+Using GDAL/OGR Without Installing
+---------------------------------
+
+To utilize GDAL/OGR the following steps need to be followed:
+
+ 1) Define GDAL_HOME to point to this directory.
+ 2) Ensure that $GDAL_HOME/lib is in the LD_LIBRARY_PATH.
+ 3) Ensure $GDAL_HOME/bin is in the PATH. 
+
+The following commands in a .cshrc file (for csh or tcsh) should suffice:
+
+  setenv GDAL_HOME ...insert path to this distribution directory...
+  set path = ($path $GDAL_HOME/bin)
+  if ( $?LD_LIBRARY_PATH == 0 ) then
+    setenv LD_LIBRARY_PATH $GDAL_HOME/lib
+  else
+    setenv LD_LIBRARY_PATH $LD_LIBRARY_PATH:$GDAL_HOME/lib
+  endif
+
+The following commands should work for bash, sh, ksh and zsh:
+
+  GDAL_HOME=...insert path to this distribution directory...
+  export GDAL_HOME
+  PATH=$PATH:$GDAL_HOME/bin
+  if test "${LD_LIBRARY_PATH:-EMPTY}" == "EMPTY" ; then
+    LD_LIBRARY_PATH=$GDAL_HOME/lib
+    export LD_LIBRARY_PATH
+  else
+    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GDAL_HOME/lib
+  fi
+
diff --git a/dist_docs/README_WIN_BIN.TXT b/dist_docs/README_WIN_BIN.TXT
new file mode 100644
index 0000000..e086fce
--- /dev/null
+++ b/dist_docs/README_WIN_BIN.TXT
@@ -0,0 +1,86 @@
+	GDAL Binary Distribution for Windows
+	====================================
+
+This distribution contains files necessary to use GDAL utility applications,
+as well as library and include files necessary to compile and link other
+programs against GDAL.  It also include support for using GDAL from Python 2.0.
+
+Local information about GDAL can be found in html\index.html.
+
+eg. 
+  start html\index.html
+
+Central information can be found at:
+
+  http://www.remotesensing.org/gdal
+
+
+Installation
+------------
+
+It is sufficient to unzip this distribution somewhere on your harddrive, and
+add the GDALxxx\BIN directory to your path (where xxx is the version). 
+Alternatively, just copy the contents of the BIN directory to somewhere in
+your path.
+
+For those wanting to develop with GDAL using VC++ commandline tools, a small
+setup script has been written to update the environment appropriately. To 
+use it, edit SETUP_GDAL.BAT, and modify the GDAL_DIR environment to point to
+where GDAL has been put.  Then run SETUP_GDAL.BAT in a DOS window before
+trying to compile against GDAL. 
+
+Utility Programs
+----------------
+
+The following GDAL and OGR utility programs should be available in the bin
+directory.  Visit the GDAL web page for more information on the utility
+programs. 
+
+  gdalinfo.exe: Report summary information about a GDAL supported raster file.
+  gdal_translate.exe: Translate GDAL supported raster files into other formats.
+  gdaladdo: Add overviews to selected GDAL supported formats. 
+  ogrinfo: Dump information about OGR supported vector formats.
+  ogr2ogr: Translate OGR supported vector formats to OGR supported formats.
+
+
+More Detailed Manifest
+----------------------
+
+BIN		All distributed executables, and the DLLs required for them.
+		The GDAL11.DLL is the main GDAL/OGR DLL.  PROJ.DLL is the
+		PROJ.4 DLL used by GDAL for reprojection.
+
+HTML		Web pages, a snapshot of the www.remotesensing.org/gdal web
+		pages at the time the distribution was prepared.
+
+INCLUDE		GDAL and OGR include files.  
+
+LIB		GDAL/OGR libraries.  GDAL.LIB is the omnibus GDAL/OGR static
+		library.  GDAL_I.LIB is the stub (interface) library for the
+		GDAL11.DLL.  Link against GDAL_I.LIB to use the DLL. 
+
+DATA		Data files required by OGRSpatialReference and the GDAL 
+		GeoTIFF driver for looking up EPSG coordinate systems.  Define
+		GEOTIFF_CSV to point to the directory where these files are 
+		found. 
+
+PYMOD		Python extensions for GDAL.  Add this directory to your 
+		PYTHONPATH to use from python.
+
+Supported Formats
+-----------------
+
+The html\formats_list.html document contains a generic list of supported 
+formats for GDAL, but the following issues should be kept in mind for standard
+builds on Windows:
+
+GDAL:
+ o OGDI is omitted.
+ o FITS is omitted.
+ o GRASS omitted.
+ o JPEG, PNG, GeoTIFF are all using internal library code. 
+
+OGR:
+ o OGDI omitted.
+ o PostgreSQL omitted.
+
diff --git a/dist_docs/SETUP_GDAL.BAT b/dist_docs/SETUP_GDAL.BAT
new file mode 100755
index 0000000..8cf90be
--- /dev/null
+++ b/dist_docs/SETUP_GDAL.BAT
@@ -0,0 +1,24 @@
+ at echo off
+
+set GDAL_DIR=c:\gdal114
+
+if exist %GDAL_DIR%\SETUP_GDAL.BAT goto DIROK
+
+echo -----------------------------------------------------------------------
+echo It appears that the GDAL_DIR environment variable is not set properly
+echo in SETUP_GDAL.BAT.  Please edit GDAL_SETUP.BAT, and modify the GDAL_DIR
+echo variable to contain the directory containing the SETUP_GDAL.BAT ... the
+echo base directory of the unzipped GDAL tree.
+echo -----------------------------------------------------------------------
+
+goto Done
+
+:DIROK
+
+set PATH=%GDAL_DIR%\bin;%PATH%
+set INCLUDE=%GDAL_DIR%\include;%INCLUDE%
+set LIB=%GDAL_DIR%\include;%LIB%
+set PYTHONPATH=%GDAL_DIR%\pymod;%PYTHONPATH%
+set GEOTIFF_CSV=%GDAL_DIR%\data
+
+:Done
\ No newline at end of file
diff --git a/dist_docs/burnpath.c b/dist_docs/burnpath.c
new file mode 100644
index 0000000..6fcb61f
--- /dev/null
+++ b/dist_docs/burnpath.c
@@ -0,0 +1,113 @@
+#include <stdio.h>
+#include <string.h>
+
+const static int block_size = 10000;
+
+/************************************************************************/
+/*                                main()                                */
+/************************************************************************/
+int main( int argc, char ** argv )
+
+{
+    FILE	*fp;
+    int		offset, size, overlap;
+    const char *marker;
+    const char *path;
+    const char *targetfile;
+    char        blockbuf[block_size+1];
+
+/* -------------------------------------------------------------------- */
+/*      Usage message.                                                  */
+/* -------------------------------------------------------------------- */
+    if( argc < 4 )
+    {
+        printf( "\n" );
+        printf( "Usage: burnpath <targetfile> <marker_string> <path>\n" );
+        printf( "\n" );
+        printf( "eg. \n" );
+        printf( "   %% burnpath /opt/lib/libgdal.1.1.so __INST_DATA_TARGET: /opt/share/gdal\n" );
+        exit( 1 );
+    }
+
+    targetfile = argv[1];
+    marker = argv[2];
+    path = argv[3];
+
+    overlap = strlen(marker) + strlen(path) + 1;
+
+/* -------------------------------------------------------------------- */
+/*      Open the target file.                                           */
+/* -------------------------------------------------------------------- */
+    fp = fopen( targetfile, "r+" );
+    if( fp == NULL )
+    {
+        perror( "fopen" );
+        exit( 1 );
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Establish the file length.                                      */
+/* -------------------------------------------------------------------- */
+    fseek( fp, 0, SEEK_END );
+    size = ftell( fp );
+    fseek( fp, 0, SEEK_SET );
+
+/* -------------------------------------------------------------------- */
+/*      Read in the file in overlapping chunks.  We assume the          */
+/*      "space" after the marker could be up to 200 bytes.              */
+/* -------------------------------------------------------------------- */
+    for( offset = 0; offset < size; offset += block_size - overlap )
+    {
+        int    block_bytes, block_modified = 0, i;
+
+        if( offset + block_size < size )
+            block_bytes = block_size;
+        else
+            block_bytes = size - offset;
+
+        if( fseek( fp, offset, SEEK_SET ) != 0 )
+        {
+            perror( "fseek" );
+            exit( 1 );
+        }
+
+        if( fread( blockbuf, block_bytes, 1, fp ) != 1 )
+        {
+            perror( "fread" );
+            exit( 1 );
+        }
+        blockbuf[block_bytes] = '\0';
+
+        for( i = 0; i < block_bytes - overlap; i++ )
+        {
+            if( blockbuf[i] == marker[0]
+                && strncmp( blockbuf + i, marker, strlen(marker) ) == 0 )
+            {
+                strcpy( blockbuf+i+strlen(marker), path );
+                block_modified = 1;
+            }
+        }
+
+        if( block_modified )
+        {
+            if( fseek( fp, offset, SEEK_SET ) != 0 )
+            {
+                perror( "fseek" );
+                exit( 1 );
+            }
+
+            if( fwrite( blockbuf, block_bytes, 1, fp ) != 1 )
+            {
+                perror( "fwrite" );
+                exit( 1 );
+            }
+        }
+    }
+
+/* -------------------------------------------------------------------- */
+/*      We are done.                                                    */
+/* -------------------------------------------------------------------- */
+    fclose( fp );
+
+    exit( 0 );
+}
diff --git a/dist_docs/install_unx.sh b/dist_docs/install_unx.sh
new file mode 100755
index 0000000..06fa6ed
--- /dev/null
+++ b/dist_docs/install_unx.sh
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+if test $# -eq 0; then
+    echo "Usage: install_unx.sh install-path"
+    echo
+    echo "This script will attempt to install GDAL binaries, and shared"
+    echo "library in the named location."
+    exit 1
+fi
+
+PREFIX=$1
+
+if test ! -d $PREFIX ; then
+  echo "Directory $PREFIX does not exist.  Please create or correct."
+  exit 1
+fi
+
+if test ! -f bin/gdalinfo ; then
+  echo "This script must be run from within the unpacked binary distribution"
+  echo "directory."
+  exit 1
+fi
+
+###############################################################################
+# Ensure required subdirectories exist.
+#
+
+if test ! -d $PREFIX/lib ; then
+  mkdir $PREFIX/lib
+fi
+if test ! -d $PREFIX/bin ; then
+  mkdir $PREFIX/bin
+fi
+if test ! -d $PREFIX/share ; then
+  mkdir $PREFIX/share
+fi
+if test ! -d $PREFIX/share/gdal ; then
+  mkdir $PREFIX/share/gdal
+fi
+
+###############################################################################
+# The following is intended to "burn" an updated INST_DATA location
+# into the given file over the preformatted message embedded in the so.
+# Look at gcore/gdaldrivermanager.cpp for a clue as to what is going on there.
+#
+
+SHARED_LIB=libgdal.1.1.so
+
+for SHARED_LIB in lib/* ; do
+  cp $SHARED_LIB $PREFIX/lib
+  bin/burnpath $PREFIX/$SHARED_LIB __INST_DATA_TARGET: $PREFIX/share/gdal
+done
+
+###############################################################################
+# Copy the rest of the files.
+#
+
+cp share/gdal/* $PREFIX/share/gdal
+
+for EXECUTABLE in bin/* ; do
+  if test "$EXECUTABLE" == "bin/gdal-config" -o "$EXECUTABLE" == "bin/burnpath" ; then
+    /bin/true
+  else
+    cp $EXECUTABLE $PREFIX/bin
+    bin/burnpath $PREFIX/$EXECUTABLE __INST_DATA_TARGET: $PREFIX/share/gdal
+  fi
+done
+
+echo "Installation of GDAL to $PREFIX complete."
+
diff --git a/doxygen_sqlite3.db b/doxygen_sqlite3.db
new file mode 100644
index 0000000..6e05a1a
Binary files /dev/null and b/doxygen_sqlite3.db differ
diff --git a/frmts/bsb/bsb_read.c b/frmts/bsb/bsb_read.c
index f3f3f4e..9c3f6be 100644
--- a/frmts/bsb/bsb_read.c
+++ b/frmts/bsb/bsb_read.c
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: bsb_read.c 28039 2014-11-30 18:24:59Z rouault $
+ * $Id: bsb_read.c 32974 2016-01-13 22:38:54Z rouault $
  *
  * Project:  BSB Reader
  * Purpose:  Low level BSB Access API Implementation (non-GDAL).
@@ -37,7 +37,7 @@
 #include "cpl_conv.h"
 #include "cpl_string.h"
 
-CPL_CVSID("$Id: bsb_read.c 28039 2014-11-30 18:24:59Z rouault $");
+CPL_CVSID("$Id: bsb_read.c 32974 2016-01-13 22:38:54Z rouault $");
 
 static int BSBReadHeaderLine( BSBInfo *psInfo, char* pszLine, int nLineMaxLen, int bNO1 );
 static int BSBSeekAndCheckScanlineNumber ( BSBInfo *psInfo, int nScanline,
@@ -273,21 +273,6 @@ BSBInfo *BSBOpen( const char *pszFilename )
                                                     FALSE,FALSE);
             nCount = CSLCount(papszTokens);
         }
-        else if( EQUALN(szLine,"    ",4) && szLine[4] != ' ' )
-        {
-            /* add extension lines to the last header line. */
-            int iTargetHeader = CSLCount(psInfo->papszHeader);
-
-            if( iTargetHeader != -1 )
-            {
-                psInfo->papszHeader[iTargetHeader] = (char *) 
-                    CPLRealloc(psInfo->papszHeader[iTargetHeader],
-                               strlen(psInfo->papszHeader[iTargetHeader])
-                               + strlen(szLine) + 5 );
-                strcat( psInfo->papszHeader[iTargetHeader], "," );
-                strcat( psInfo->papszHeader[iTargetHeader], szLine+4 );
-            }
-        }
 
         if( EQUALN(szLine,"BSB/",4) )
         {
@@ -590,7 +575,9 @@ static int BSBReadHeaderLine( BSBInfo *psInfo, char* pszLine, int nLineMaxLen, i
     while( !VSIFEofL(psInfo->fp) && nLineLen < nLineMaxLen-1 )
     {
         chNext = (char) BSBGetc( psInfo, bNO1, NULL );
-        if( chNext == 0x1A )
+        /* '\0' is not really expected at this point in correct products */
+        /* but we must escape if found. */
+        if( chNext == '\0' || chNext == 0x1A )
         {
             BSBUngetc( psInfo, chNext );
             return FALSE;
diff --git a/frmts/gtiff/geotiff.cpp b/frmts/gtiff/geotiff.cpp
index 035364d..39b54f5 100644
--- a/frmts/gtiff/geotiff.cpp
+++ b/frmts/gtiff/geotiff.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: geotiff.cpp 29355 2015-06-15 09:27:47Z rouault $
+ * $Id: geotiff.cpp 33053 2016-01-20 10:53:18Z rouault $
  *
  * Project:  GeoTIFF Driver
  * Purpose:  GDAL GeoTIFF support.
@@ -63,7 +63,7 @@
 #include "tiffiop.h"
 #endif
 
-CPL_CVSID("$Id: geotiff.cpp 29355 2015-06-15 09:27:47Z rouault $");
+CPL_CVSID("$Id: geotiff.cpp 33053 2016-01-20 10:53:18Z rouault $");
 
 #if SIZEOF_VOIDP == 4
 static int bGlobalStripIntegerOverflow = FALSE;
@@ -716,13 +716,10 @@ CPLErr GTiffJPEGOverviewBand::IReadBlock( int nBlockXOff, int nBlockYOff, void *
             /* If the JPEG strip/tile is too big (e.g. a single-strip JPEG-in-TIFF) */
             /* we will use /vsisparse mechanism to make a fake JPEG file */
 
-            /* If the previous file was NOT opened as a /vsisparse/, we have to re-open */
-            if( poGDS->poJPEGDS != NULL &&
-                strncmp(GDALGetDescription(poGDS->poJPEGDS), "/vsisparse/", strlen("/vsisparse/")) != 0  )
-            {
-                GDALClose( (GDALDatasetH) poGDS->poJPEGDS );
-                poGDS->poJPEGDS = NULL;
-            }
+            /* Always re-open */
+            GDALClose( (GDALDatasetH) poGDS->poJPEGDS );
+            poGDS->poJPEGDS = NULL;
+
             osFileToOpen = CPLSPrintf("/vsisparse/%s", poGDS->osTmpFilename.c_str());
 
             VSIFPrintfL(fp, "<VSISparseFile><SubfileRegion><Filename relative='0'>%s</Filename>"
@@ -1061,7 +1058,8 @@ GTiffRasterBand::GTiffRasterBand( GTiffDataset *poDS, int nBand )
             int nBaseSamples;
             nBaseSamples = poDS->nSamplesPerPixel - count;
 
-            if( nBand > nBaseSamples 
+            if( nBand > nBaseSamples
+                && nBand-nBaseSamples-1 < count
                 && (v[nBand-nBaseSamples-1] == EXTRASAMPLE_ASSOCALPHA
                     || v[nBand-nBaseSamples-1] == EXTRASAMPLE_UNASSALPHA) )
                 eBandInterp = GCI_AlphaBand;
@@ -1229,7 +1227,10 @@ CPLErr GTiffRasterBand::DirectIO( GDALRWFlag eRWFlag,
     {
         for(iLine=0;iLine<nReqYSize;iLine++)
         {
-            GDALSwapWords( ppData[iLine], nDTSize, nReqXSize * nContigBands, nDTSize);
+            if( GDALDataTypeIsComplex(eDataType) )
+                GDALSwapWords( ppData[iLine], nDTSize / 2, 2 * nReqXSize * nContigBands, nDTSize / 2);
+            else
+                GDALSwapWords( ppData[iLine], nDTSize, nReqXSize * nContigBands, nDTSize);
         }
     }
 
@@ -1681,6 +1682,19 @@ int GTiffDataset::VirtualMemIO( GDALRWFlag eRWFlag,
     if( !SetDirectory() )
         return CE_Failure;
 
+    if( !(nCompression == COMPRESSION_NONE &&
+        (nPhotometric == PHOTOMETRIC_MINISBLACK ||
+        nPhotometric == PHOTOMETRIC_RGB ||
+        nPhotometric == PHOTOMETRIC_PALETTE) &&
+        (nBitsPerSample == 8 || (nBitsPerSample == 16) ||
+        nBitsPerSample == 32 || nBitsPerSample == 64) &&
+        nBitsPerSample == GDALGetDataTypeSize(eDataType) &&
+        !TIFFIsByteSwapped(hTIFF) ) )
+    {
+        eVirtualMemIOUsage = VIRTUAL_MEM_IO_NO;
+        return -1;
+    }
+
     size_t nMappingSize = 0;
     GByte* pabySrcData = NULL;
     if( strncmp(GetDescription(), "/vsimem/", strlen("/vsimem/")) == 0 )
@@ -1693,18 +1707,6 @@ int GTiffDataset::VirtualMemIO( GDALRWFlag eRWFlag,
     }
     else if( psVirtualMemIOMapping == NULL )
     {
-        if( !(nCompression == COMPRESSION_NONE &&
-              (nPhotometric == PHOTOMETRIC_MINISBLACK ||
-              nPhotometric == PHOTOMETRIC_RGB ||
-              nPhotometric == PHOTOMETRIC_PALETTE) &&
-              (nBitsPerSample == 8 || (nBitsPerSample == 16) ||
-              nBitsPerSample == 32 || nBitsPerSample == 64) &&
-              nBitsPerSample == GDALGetDataTypeSize(eDataType) &&
-              !TIFFIsByteSwapped(hTIFF) ) )
-        {
-            eVirtualMemIOUsage = VIRTUAL_MEM_IO_NO;
-            return -1;
-        }
         VSILFILE* fp = VSI_TIFFGetVSILFile(TIFFClientdata( hTIFF ));
         if( !CPLIsVirtualMemFileMapAvailable() ||
             VSIFGetNativeFileDescriptorL(fp) == NULL )
@@ -2345,7 +2347,10 @@ CPLErr GTiffDataset::DirectIO( GDALRWFlag eRWFlag,
     {
         for(iLine=0;iLine<nReqYSize;iLine++)
         {
-            GDALSwapWords( ppData[iLine], nDTSize, nReqXSize * nContigBands, nDTSize);
+            if( GDALDataTypeIsComplex(eDataType) )
+                GDALSwapWords( ppData[iLine], nDTSize / 2, 2 * nReqXSize * nContigBands, nDTSize / 2);
+            else
+                GDALSwapWords( ppData[iLine], nDTSize, nReqXSize * nContigBands, nDTSize);
         }
     }
 
@@ -3128,7 +3133,7 @@ CPLErr GTiffRasterBand::SetMetadata( char ** papszMD, const char *pszDomain )
             // Cancel any existing metadata from PAM file
             if( eAccess == GA_Update &&
                 GDALPamRasterBand::GetMetadata(pszDomain) != NULL )
-                GDALPamRasterBand::SetMetadata(papszMD, pszDomain);
+                GDALPamRasterBand::SetMetadata(NULL, pszDomain);
         }
     }
 
@@ -5168,7 +5173,7 @@ int GTiffDataset::GetJPEGOverviewCount()
         return nJPEGOverviewCount;
 
     nJPEGOverviewCount = 0;
-    if( eAccess != GA_ReadOnly || nCompression != COMPRESSION_JPEG ||
+    if( !bBase || eAccess != GA_ReadOnly || nCompression != COMPRESSION_JPEG ||
         (nRasterXSize < 256 && nRasterYSize < 256) ||
         !CSLTestBoolean(CPLGetConfigOption("GTIFF_IMPLICIT_JPEG_OVR", "YES")) ||
         GDALGetDriverByName("JPEG") == NULL )
@@ -5765,7 +5770,14 @@ CPLErr GTiffDataset::LoadBlockBuf( int nBlockId, int bReadFromDisk )
         }
     }
 
-    nLoadedBlock = nBlockId;
+    if( eErr == CE_None )
+    {
+        nLoadedBlock = nBlockId;
+    }
+    else
+    {
+        nLoadedBlock = -1;
+    }
     bLoadedBlockDirty = FALSE;
 
     return eErr;
@@ -7230,7 +7242,8 @@ void GTiffDataset::WriteGeoTIFFInfo()
 /* -------------------------------------------------------------------- */
 /*	Write out projection definition.				*/
 /* -------------------------------------------------------------------- */
-    if( pszProjection != NULL && !EQUAL( pszProjection, "" )
+    const bool bHasProjection = (pszProjection != NULL && strlen(pszProjection) > 0);
+    if( (bHasProjection || bPixelIsPoint)
         && !EQUAL(osProfile,"BASELINE") )
     {
         GTIF	*psGTIF;
@@ -7244,7 +7257,10 @@ void GTiffDataset::WriteGeoTIFFInfo()
         psGTIF = GTIFNew( hTIFF );  
 
         // set according to coordinate system.
-        GTIFSetFromOGISDefn( psGTIF, pszProjection );
+        if( bHasProjection )
+        {
+            GTIFSetFromOGISDefn( psGTIF, pszProjection );
+        }
 
         if( bPixelIsPoint )
         {
@@ -9480,8 +9496,12 @@ CPLErr GTiffDataset::OpenOffset( TIFF *hTIFFIn,
         // Lets treat large "one row" bitmaps using the scanline api.
         if( !TIFFIsTiled(hTIFF) 
             && nBlockYSize == nYSize 
-            && nYSize > 2000 )
+            && nYSize > 2000
+            /* libtiff does not support reading JBIG files with TIFFReadScanline() */
+            && nCompression != COMPRESSION_JBIG )
+        {
             bTreatAsSplitBitmap = TRUE;
+        }
     }
 
 /* -------------------------------------------------------------------- */
@@ -9572,6 +9592,31 @@ CPLErr GTiffDataset::OpenOffset( TIFF *hTIFFIn,
               && nBitsPerSample != 128 )
         bTreatAsOdd = TRUE;
 
+/* -------------------------------------------------------------------- */
+/*      We don't support 'chunks' bigger than 2GB although libtiff v4   */
+/*      can.                                                            */
+/* -------------------------------------------------------------------- */
+#if defined(BIGTIFF_SUPPORT)
+    tmsize_t nChunkSize;
+    if( bTreatAsSplit || bTreatAsSplitBitmap )
+    {
+        nChunkSize = TIFFScanlineSize( hTIFF );
+    }
+    else
+    {
+        if( TIFFIsTiled(hTIFF) )
+            nChunkSize = TIFFTileSize( hTIFF );
+        else
+            nChunkSize = TIFFStripSize( hTIFF );
+    }
+    if( nChunkSize > INT_MAX )
+    {
+        CPLError( CE_Failure, CPLE_NotSupported,
+                  "Scanline/tile/strip size bigger than 2GB." );
+        return CE_Failure;
+    }
+#endif
+
     int bMinIsWhite = nPhotometric == PHOTOMETRIC_MINISWHITE;
 
 /* -------------------------------------------------------------------- */
@@ -10190,6 +10235,7 @@ void GTiffDataset::ScanDirectories()
         /* Embedded mask of the main image */
         else if ((nSubType & FILETYPE_MASK) != 0 &&
                  (nSubType & FILETYPE_REDUCEDIMAGE) == 0 &&
+                 iDirIndex != 1 &&
                  poMaskDS == NULL )
         {
             poMaskDS = new GTiffDataset();
@@ -10226,7 +10272,8 @@ void GTiffDataset::ScanDirectories()
         /* Embedded mask of an overview */
         /* The TIFF6 specification allows the combination of the FILETYPE_xxxx masks */
         else if ((nSubType & FILETYPE_REDUCEDIMAGE) != 0 &&
-                 (nSubType & FILETYPE_MASK) != 0)
+                 (nSubType & FILETYPE_MASK) != 0 &&
+                 iDirIndex != 1)
         {
             GTiffDataset* poDS = new GTiffDataset();
             if( poDS->OpenOffset( hTIFF, ppoActiveDSRef, nThisDir, FALSE, 
@@ -12111,16 +12158,19 @@ GTiffDataset::CreateCopy( const char * pszFilename, GDALDataset *poSrcDS,
 /* -------------------------------------------------------------------- */
 /*      Write the projection information, if possible.                  */
 /* -------------------------------------------------------------------- */
-    if( pszProjection != NULL && strlen(pszProjection) > 0 && bGeoTIFF )
+    const bool bHasProjection = (pszProjection != NULL && strlen(pszProjection) > 0);
+    if( (bHasProjection || bPixelIsPoint) && bGeoTIFF )
     {
         GTIF	*psGTIF;
 
         psGTIF = GTIFNew( hTIFF );
-        GTIFSetFromOGISDefn( psGTIF, pszProjection );
 
-        if( poSrcDS->GetMetadataItem( GDALMD_AREA_OR_POINT ) 
-            && EQUAL(poSrcDS->GetMetadataItem(GDALMD_AREA_OR_POINT),
-                     GDALMD_AOP_POINT) )
+        if( bHasProjection )
+        {
+            GTIFSetFromOGISDefn( psGTIF, pszProjection );
+        }
+
+        if( bPixelIsPoint )
         {
             GTIFKeySet(psGTIF, GTRasterTypeGeoKey, TYPE_SHORT, 1,
                        RasterPixelIsPoint);
@@ -12899,7 +12949,7 @@ CPLErr GTiffDataset::SetMetadata( char ** papszMD, const char *pszDomain )
         // Cancel any existing metadata from PAM file
         if( eAccess == GA_Update &&
             GDALPamDataset::GetMetadata(pszDomain) != NULL )
-            GDALPamDataset::SetMetadata(papszMD, pszDomain);
+            GDALPamDataset::SetMetadata(NULL, pszDomain);
     }
 
     if( (pszDomain == NULL || EQUAL(pszDomain, "")) &&
@@ -13428,8 +13478,6 @@ int GTiffOneTimeInit()
     TIFFSetWarningHandler( GTiffWarningHandler );
     TIFFSetErrorHandler( GTiffErrorHandler );
 
-    // This only really needed if we are linked to an external libgeotiff
-    // with its own (lame) file searching logic. 
     LibgeotiffOneTimeInit();
 
     return TRUE;
diff --git a/frmts/gtiff/gt_wkt_srs.cpp b/frmts/gtiff/gt_wkt_srs.cpp
index 209625b..8d6feee 100644
--- a/frmts/gtiff/gt_wkt_srs.cpp
+++ b/frmts/gtiff/gt_wkt_srs.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gt_wkt_srs.cpp 29049 2015-04-29 15:54:12Z rouault $
+ * $Id: gt_wkt_srs.cpp 31128 2015-10-25 18:07:26Z rouault $
  *
  * Project:  GeoTIFF Driver
  * Purpose:  Implements translation between GeoTIFF normalized projection
@@ -46,7 +46,7 @@
 #include "gt_wkt_srs_priv.h"
 #include "gtiff.h"
 
-CPL_CVSID("$Id: gt_wkt_srs.cpp 29049 2015-04-29 15:54:12Z rouault $")
+CPL_CVSID("$Id: gt_wkt_srs.cpp 31128 2015-10-25 18:07:26Z rouault $")
 
 #define ProjLinearUnitsInterpCorrectGeoKey   3059
 
@@ -107,6 +107,9 @@ void LibgeotiffOneTimeInit()
     // If linking with an external libgeotiff we hope this will call the
     // SetCSVFilenameHook() in libgeotiff, not the one in gdal/port!
     SetCSVFilenameHook( GDALDefaultCSVFilename );
+
+    // This isn't thread-safe, so better do it now
+    XTIFFInitialize();
 }
 
 /************************************************************************/
@@ -211,11 +214,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: 29049 $ $Date: 2015-04-29 08:54:12 -0700 (Wed, 29 Apr 2015) $\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: 31128 $ $Date: 2015-10-25 11:07:26 -0700 (Sun, 25 Oct 2015) $\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: 29049 $ $Date: 2015-04-29 08:54:12 -0700 (Wed, 29 Apr 2015) $\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: 31128 $ $Date: 2015-10-25 11:07:26 -0700 (Sun, 25 Oct 2015) $\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: 29049 $ $Date: 2015-04-29 08:54:12 -0700 (Wed, 29 Apr 2015) $\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: 31128 $ $Date: 2015-10-25 11:07:26 -0700 (Sun, 25 Oct 2015) $\nUTM Zone 10N\nEllipsoid = Clarke 1866\nDatum = NAD27 (CONUS)"
  
 */
 
@@ -633,8 +636,12 @@ char *GTIFGetOGISDefn( GTIF *hGTIF, GTIFDefn * psDefn )
     }
     else
     {
-        GDALGTIFKeyGetDOUBLE(hGTIF, GeogAngularUnitSizeGeoKey, &(psDefn->UOMAngleInDegrees), 0, 1 );
-        aUnitGot = TRUE;
+        double dfRadians = 0.0;
+        if( GDALGTIFKeyGetDOUBLE(hGTIF, GeogAngularUnitSizeGeoKey, &dfRadians, 0, 1 ) )
+        {
+            aUnitGot = TRUE;
+            psDefn->UOMAngleInDegrees = dfRadians / CPLAtof(SRS_UA_DEGREE_CONV);
+        }
     }
 
     if( pszDatumName != NULL )
@@ -664,20 +671,12 @@ char *GTIFGetOGISDefn( GTIF *hGTIF, GTIFDefn * psDefn )
         pszGeogName = CPLStrdup( pszDatumName ? pszDatumName : "unknown" );
     }
 
-    if(aUnitGot)
-        oSRS.SetGeogCS( pszGeogName, pszDatumName, 
-                        pszSpheroidName, dfSemiMajor, dfInvFlattening,
-                        pszPMName,
-                        psDefn->PMLongToGreenwich / psDefn->UOMAngleInDegrees,
-                        pszAngularUnits,
-                        psDefn->UOMAngleInDegrees );
-    else
-        oSRS.SetGeogCS( pszGeogName, pszDatumName, 
-                        pszSpheroidName, dfSemiMajor, dfInvFlattening,
-                        pszPMName,
-                        psDefn->PMLongToGreenwich / psDefn->UOMAngleInDegrees,
-                        pszAngularUnits,
-                        psDefn->UOMAngleInDegrees * 0.0174532925199433 );
+    oSRS.SetGeogCS( pszGeogName, pszDatumName, 
+                    pszSpheroidName, dfSemiMajor, dfInvFlattening,
+                    pszPMName,
+                    psDefn->PMLongToGreenwich / psDefn->UOMAngleInDegrees,
+                    pszAngularUnits,
+                    psDefn->UOMAngleInDegrees * CPLAtof(SRS_UA_DEGREE_CONV) );
 
     if( psDefn->GCS != KvUserDefined && psDefn->GCS > 0 )
         oSRS.SetAuthority( "GEOGCS", "EPSG", psDefn->GCS );
@@ -2253,6 +2252,24 @@ int GTIFSetFromOGISDefn( GTIF * psGTIF, const char *pszOGCWKT )
     if(EQUAL(angUnitName, "Degree"))
         GTIFKeySet(psGTIF, GeogAngularUnitsGeoKey, TYPE_SHORT, 1, 
                    Angular_Degree );
+    else if (EQUAL(angUnitName, "arc-second"))
+        GTIFKeySet(psGTIF, GeogAngularUnitsGeoKey, TYPE_SHORT, 1,
+                   Angular_Arc_Second);
+    else if (EQUAL(angUnitName, "arc-minute"))
+        GTIFKeySet(psGTIF, GeogAngularUnitsGeoKey, TYPE_SHORT, 1,
+                   Angular_Arc_Minute);
+    else if (EQUAL(angUnitName, "grad"))
+        GTIFKeySet(psGTIF, GeogAngularUnitsGeoKey, TYPE_SHORT, 1,
+                   Angular_Grad);
+    else if (EQUAL(angUnitName, "gon"))
+        GTIFKeySet(psGTIF, GeogAngularUnitsGeoKey, TYPE_SHORT, 1,
+                   Angular_Gon);
+    else if (EQUAL(angUnitName, "radian"))
+        GTIFKeySet(psGTIF, GeogAngularUnitsGeoKey, TYPE_SHORT, 1,
+                   Angular_Radian);
+    /*else if (EQUAL(angUnitName, "microradian"))
+        GTIFKeySet(psGTIF, GeogAngularUnitsGeoKey, TYPE_SHORT, 1,
+                   9109);*/
     else if(angUnitName)
     {
         GTIFKeySet(psGTIF, GeogCitationGeoKey, TYPE_ASCII, 0, 
diff --git a/frmts/hfa/hfaband.cpp b/frmts/hfa/hfaband.cpp
index 1f2d433..b70a7bc 100644
--- a/frmts/hfa/hfaband.cpp
+++ b/frmts/hfa/hfaband.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: hfaband.cpp 28435 2015-02-07 14:35:34Z rouault $
+ * $Id: hfaband.cpp 31391 2015-11-08 12:14:09Z rouault $
  *
  * Project:  Erdas Imagine (.img) Translator
  * Purpose:  Implementation of the HFABand, for accessing one Eimg_Layer.
@@ -33,7 +33,7 @@
 
 /* include the compression code */
 
-CPL_CVSID("$Id: hfaband.cpp 28435 2015-02-07 14:35:34Z rouault $");
+CPL_CVSID("$Id: hfaband.cpp 31391 2015-11-08 12:14:09Z rouault $");
 
 /************************************************************************/
 /*                              HFABand()                               */
@@ -727,9 +727,10 @@ static CPLErr UncompressBlock( GByte *pabyCData, int nSrcBytes,
         return CE_Failure;
     }
 
-    if (nNumBits > INT_MAX / nNumRuns ||
-        nNumBits * nNumRuns > INT_MAX - 7 ||
-        (nNumBits * nNumRuns + 7)/8 > INT_MAX - nDataOffset)
+    if (nNumRuns != 0 &&
+        (nNumBits > INT_MAX / nNumRuns ||
+         nNumBits * nNumRuns > INT_MAX - 7 ||
+         (nNumBits * nNumRuns + 7)/8 > INT_MAX - nDataOffset) )
     {
         CPLError(CE_Failure, CPLE_AppDefined,
                  "Integer overflow : nDataOffset + (nNumBits * nNumRuns + 7)/8");
diff --git a/frmts/hfa/hfaentry.cpp b/frmts/hfa/hfaentry.cpp
index 8d36c46..b8a126e 100644
--- a/frmts/hfa/hfaentry.cpp
+++ b/frmts/hfa/hfaentry.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: hfaentry.cpp 28275 2015-01-02 18:45:58Z rouault $
+ * $Id: hfaentry.cpp 32495 2015-12-27 13:07:01Z rouault $
  *
  * Project:  Erdas Imagine (.img) Translator
  * Purpose:  Implementation of the HFAEntry class for reading and relating
@@ -38,7 +38,7 @@
 #include "hfa_p.h"
 #include "cpl_conv.h"
 
-CPL_CVSID("$Id: hfaentry.cpp 28275 2015-01-02 18:45:58Z rouault $");
+CPL_CVSID("$Id: hfaentry.cpp 32495 2015-12-27 13:07:01Z rouault $");
 
 /************************************************************************/
 /*                              HFAEntry()                              */
@@ -464,6 +464,12 @@ void HFAEntry::LoadData()
 {
     if( pabyData != NULL || nDataSize == 0 )
         return;
+    if( nDataSize > INT_MAX - 1 )
+    {
+        CPLError( CE_Failure, CPLE_AppDefined,
+                  "Invalid value for nDataSize = %u", nDataSize);
+        return;
+    }
 
 /* -------------------------------------------------------------------- */
 /*      Allocate buffer, and read data.                                 */
diff --git a/frmts/kmlsuperoverlay/kmlsuperoverlaydataset.cpp b/frmts/kmlsuperoverlay/kmlsuperoverlaydataset.cpp
index 860f9e7..58767b0 100644
--- a/frmts/kmlsuperoverlay/kmlsuperoverlaydataset.cpp
+++ b/frmts/kmlsuperoverlay/kmlsuperoverlaydataset.cpp
@@ -1136,18 +1136,30 @@ CPLErr KmlSuperOverlayReadDataset::IRasterIO( GDALRWFlag eRWFlag,
 {
     if( eRWFlag == GF_Write )
         return CE_Failure;
-    
+
     if( bIsOvr )
+    {
+        GDALRasterIOExtraArg sExtraArgs;
+        GDALCopyRasterIOExtraArg(&sExtraArgs, psExtraArg);
+        const int nOvrFactor = poParent->nFactor / nFactor;
+        if( sExtraArgs.bFloatingPointWindowValidity )
+        {
+            sExtraArgs.dfXOff *= nOvrFactor;
+            sExtraArgs.dfYOff *= nOvrFactor;
+            sExtraArgs.dfXSize *= nOvrFactor;
+            sExtraArgs.dfYSize *= nOvrFactor;
+        }
         return poParent->IRasterIO( eRWFlag,
-                                    nXOff * (poParent->nFactor / nFactor),
-                                    nYOff * (poParent->nFactor / nFactor),
-                                    nXSize * (poParent->nFactor / nFactor),
-                                    nYSize * (poParent->nFactor / nFactor),
+                                    nXOff * nOvrFactor,
+                                    nYOff * nOvrFactor,
+                                    nXSize * nOvrFactor,
+                                    nYSize * nOvrFactor,
                                     pData, nBufXSize, nBufYSize,
                                     eBufType, 
                                     nBandCount, panBandMap,
-                                    nPixelSpace, nLineSpace, nBandSpace, psExtraArg);
-    
+                                    nPixelSpace, nLineSpace, nBandSpace, &sExtraArgs);
+    }
+
     double dfXOff = 1.0 * nXOff / nFactor;
     double dfYOff = 1.0 * nYOff / nFactor;
     double dfXSize = 1.0 * nXSize / nFactor;
@@ -1384,6 +1396,9 @@ CPLErr KmlSuperOverlayReadDataset::IRasterIO( GDALRWFlag eRWFlag,
             if( nReqYOff + nReqYSize > poVRTDS->GetRasterYSize() )
                 nReqYSize = poVRTDS->GetRasterYSize() - nReqYOff;
 
+            GDALRasterIOExtraArg sExtraArgs;
+            INIT_RASTERIO_EXTRA_ARG(sExtraArgs);
+            sExtraArgs.eResampleAlg = psExtraArg->eResampleAlg;
             CPLErr eErr = poVRTDS->RasterIO( eRWFlag,
                                              nReqXOff,
                                              nReqYOff,
@@ -1392,7 +1407,7 @@ CPLErr KmlSuperOverlayReadDataset::IRasterIO( GDALRWFlag eRWFlag,
                                              pData, nBufXSize, nBufYSize, eBufType,
                                              nBandCount, panBandMap,
                                              nPixelSpace, nLineSpace, nBandSpace,
-                                             psExtraArg);
+                                             &sExtraArgs);
 
             for(i=0; i < (int)aosImages.size(); i++)
             {
@@ -1435,8 +1450,11 @@ CPLErr KmlSuperOverlayReadDataset::IRasterIO( GDALRWFlag eRWFlag,
         if( nReqYOff + nReqYSize > poDSIcon->GetRasterYSize() )
             nReqYSize = poDSIcon->GetRasterYSize() - nReqYOff;
 
-        psExtraArg->pfnProgress = GDALScaledProgress;
-        psExtraArg->pProgressData = 
+        GDALRasterIOExtraArg sExtraArgs;
+        INIT_RASTERIO_EXTRA_ARG(sExtraArgs);
+        sExtraArgs.eResampleAlg = psExtraArg->eResampleAlg;
+        sExtraArgs.pfnProgress = GDALScaledProgress;
+        sExtraArgs.pProgressData = 
             GDALCreateScaledProgress( 1.0 * iBandIdx / nBandCount,
                                       1.0 * (iBandIdx + 1) / nBandCount,
                                       pfnProgressGlobal,
@@ -1450,9 +1468,9 @@ CPLErr KmlSuperOverlayReadDataset::IRasterIO( GDALRWFlag eRWFlag,
                                                       ((GByte*) pData) + nBandSpace * iBandIdx,
                                                       nBufXSize, nBufYSize, eBufType,
                                                       nPixelSpace, nLineSpace,
-                                                      psExtraArg);
+                                                      &sExtraArgs);
 
-        GDALDestroyScaledProgress( psExtraArg->pProgressData );
+        GDALDestroyScaledProgress( sExtraArgs.pProgressData );
     }
 
     psExtraArg->pfnProgress = pfnProgressGlobal;
diff --git a/frmts/netcdf/netcdfdataset.cpp b/frmts/netcdf/netcdfdataset.cpp
index faf51df..74ed3b6 100644
--- a/frmts/netcdf/netcdfdataset.cpp
+++ b/frmts/netcdf/netcdfdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: netcdfdataset.cpp 29200 2015-05-15 18:04:02Z rouault $
+ * $Id: netcdfdataset.cpp 31864 2015-12-01 10:08:27Z rouault $
  *
  * Project:  netCDF read/write Driver
  * Purpose:  GDAL bindings over netCDF library.
@@ -33,7 +33,7 @@
 #include "cpl_error.h"
 #include "cpl_multiproc.h"
 
-CPL_CVSID("$Id: netcdfdataset.cpp 29200 2015-05-15 18:04:02Z rouault $");
+CPL_CVSID("$Id: netcdfdataset.cpp 31864 2015-12-01 10:08:27Z rouault $");
 
 #include <map> //for NCDFWriteProjAttribs()
 
@@ -914,11 +914,11 @@ CPLXMLNode *netCDFRasterBand::SerializeToXML( CPL_UNUSED const char *pszUnused )
 CPLErr netCDFRasterBand::CreateBandMetadata( int *paDimIds ) 
 
 {
-    char     szVarName[NC_MAX_NAME];
-    char     szMetaName[NC_MAX_NAME];
+    char     szVarName[NC_MAX_NAME+1];
+    char     szMetaName[NC_MAX_NAME+1];
     char     szMetaTemp[NCDF_MAX_STR_LEN];
     char     *pszMetaValue = NULL;
-    char     szTemp[NC_MAX_NAME];
+    char     szTemp[NC_MAX_NAME+1];
 
     int      nd;
     int      i,j;
@@ -938,6 +938,7 @@ CPLErr netCDFRasterBand::CreateBandMetadata( int *paDimIds )
 /* -------------------------------------------------------------------- */
 /*      Compute all dimensions from Band number and save in Metadata    */
 /* -------------------------------------------------------------------- */
+    szVarName[0] = '\0';
     nc_inq_varname( cdfid, nZId, szVarName );
     nc_inq_varndims( cdfid, nZId, &nd );
 /* -------------------------------------------------------------------- */
@@ -1049,6 +1050,7 @@ CPLErr netCDFRasterBand::CreateBandMetadata( int *paDimIds )
 
     for( i=0; i < nAtt ; i++ ) {
 
+        szTemp[0] = '\0';
     	status = nc_inq_attname( cdfid, nZId, i, szTemp);
     	// if(strcmp(szTemp,_FillValue) ==0) continue;
     	sprintf( szMetaName,"%s",szTemp);       
@@ -1753,7 +1755,7 @@ void netCDFDataset::SetProjectionFromVar( int nVarId )
     unsigned int i=0;
     const char   *pszValue = NULL;
     int          nVarProjectionID = -1;
-    char         szVarName[ MAX_NC_NAME ];
+    char         szVarName[ MAX_NC_NAME+1 ];
     char         szTemp[ MAX_NC_NAME ];
     char         szGridMappingName[ MAX_NC_NAME ];
     char         szGridMappingValue[ MAX_NC_NAME ];
@@ -1786,8 +1788,8 @@ void netCDFDataset::SetProjectionFromVar( int nVarId )
     int          nVarDimYID = -1;
     double       *pdfXCoord = NULL;
     double       *pdfYCoord = NULL;
-    char         szDimNameX[ MAX_NC_NAME ];
-    char         szDimNameY[ MAX_NC_NAME ];
+    char         szDimNameX[ MAX_NC_NAME+1 ];
+    char         szDimNameY[ MAX_NC_NAME+1 ];
     int          nSpacingBegin=0;
     int          nSpacingMiddle=0;
     int          nSpacingLast=0;
@@ -1801,7 +1803,6 @@ void netCDFDataset::SetProjectionFromVar( int nVarId )
     /* These values from GDAL metadata */
     const char *pszWKT = NULL;
     const char *pszGeoTransform = NULL;
-    char **papszGeoTransform = NULL;
 
     netCDFDataset * poDS = this; /* perhaps this should be removed for clarity */
 
@@ -1837,6 +1838,7 @@ void netCDFDataset::SetProjectionFromVar( int nVarId )
     strcpy( szGridMappingValue, "" );
     strcpy( szGridMappingName, "" );
 
+    szVarName[0] = '\0';
     nc_inq_varname( cdfid, nVarId, szVarName );
     strcpy(szTemp,szVarName);
     strcat(szTemp,"#");
@@ -1913,8 +1915,8 @@ void netCDFDataset::SetProjectionFromVar( int nVarId )
 /*      Look for dimension: lon                                         */
 /* -------------------------------------------------------------------- */
 
-    memset( szDimNameX, '\0', sizeof( char ) * MAX_NC_NAME );
-    memset( szDimNameY, '\0', sizeof( char ) * MAX_NC_NAME );
+    memset( szDimNameX, '\0', sizeof(szDimNameX) );
+    memset( szDimNameY, '\0', sizeof(szDimNameY) );
 
     for( i = 0; (i < strlen( poDS->papszDimName[ poDS->nXDimID ] )  && 
                  i < 3 ); i++ ) {
@@ -2896,17 +2898,16 @@ void netCDFDataset::SetProjectionFromVar( int nVarId )
 
                 if( pszGeoTransform != NULL ) {
 
-                    bGotGdalGT = TRUE;
-                    
-                    papszGeoTransform = CSLTokenizeString2( pszGeoTransform,
+                    char** papszGeoTransform = CSLTokenizeString2( pszGeoTransform,
                                                             " ", 
                                                             CSLT_HONOURSTRINGS );
-                    adfTempGeoTransform[0] = CPLAtof( papszGeoTransform[0] );
-                    adfTempGeoTransform[1] = CPLAtof( papszGeoTransform[1] );
-                    adfTempGeoTransform[2] = CPLAtof( papszGeoTransform[2] );
-                    adfTempGeoTransform[3] = CPLAtof( papszGeoTransform[3] );
-                    adfTempGeoTransform[4] = CPLAtof( papszGeoTransform[4] );
-                    adfTempGeoTransform[5] = CPLAtof( papszGeoTransform[5] );
+                    if( CSLCount(papszGeoTransform) == 6 )
+                    {
+                        bGotGdalGT = TRUE;
+                        for(int i=0;i<6;i++)
+                            adfTempGeoTransform[i] = CPLAtof( papszGeoTransform[i] );
+                    }
+                    CSLDestroy( papszGeoTransform );
                     
 /* -------------------------------------------------------------------- */
 /*      Look for corner array values                                    */
@@ -2972,7 +2973,6 @@ void netCDFDataset::SetProjectionFromVar( int nVarId )
                             - (adfTempGeoTransform[5] / 2);
                     }
                 } // (pszGeoTransform != NULL)
-                CSLDestroy( papszGeoTransform );
 
                 if ( bGotGdalSRS && ! bGotGdalGT )
                     CPLDebug( "GDAL_netCDF", "got SRS but not geotransform from GDAL!");
@@ -3049,8 +3049,8 @@ int netCDFDataset::ProcessCFGeolocation( int nVarId )
     char *pszTemp = NULL;
     char **papszTokens = NULL;
     CPLString osTMP;
-    char szGeolocXName[NC_MAX_NAME];
-    char szGeolocYName[NC_MAX_NAME];
+    char szGeolocXName[NC_MAX_NAME+1];
+    char szGeolocYName[NC_MAX_NAME+1];
     szGeolocXName[0] = '\0';
     szGeolocYName[0] = '\0';
 
@@ -4072,9 +4072,9 @@ double netCDFDataset::rint( double dfX)
 CPLErr netCDFDataset::ReadAttributes( int cdfid, int var)
 
 {
-    char    szAttrName[ NC_MAX_NAME ];
-    char    szVarName [ NC_MAX_NAME ];
-    char    szMetaName[ NC_MAX_NAME * 2 ];
+    char    szAttrName[ NC_MAX_NAME+1 ];
+    char    szVarName [ NC_MAX_NAME+1 ];
+    char    szMetaName[ NC_MAX_NAME * 2+1+1 ];
     char    *pszMetaTemp = NULL;
     int     nbAttr;
 
@@ -4083,11 +4083,13 @@ CPLErr netCDFDataset::ReadAttributes( int cdfid, int var)
         strcpy( szVarName,"NC_GLOBAL" );
     }
     else {
+        szVarName[0] = '\0';
         nc_inq_varname( cdfid, var, szVarName );
     }
 
     for( int l=0; l < nbAttr; l++) {
 	
+        szAttrName[0] = '\0';
         nc_inq_attname( cdfid, var, l, szAttrName);
         sprintf( szMetaName, "%s#%s", szVarName, szAttrName  );
 
@@ -4119,8 +4121,8 @@ void netCDFDataset::CreateSubDatasetList( )
     char         szDim[ MAX_NC_NAME ];
     char         szTemp[ MAX_NC_NAME ];
     char         szType[ MAX_NC_NAME ];
-    char         szName[ MAX_NC_NAME ];
-    char         szVarStdName[ MAX_NC_NAME ];
+    char         szName[ MAX_NC_NAME+1 ];
+    char         szVarStdName[ MAX_NC_NAME+1 ];
     int          nDims;
     int          nVar;
     int          nVarCount;
@@ -4202,9 +4204,12 @@ void netCDFDataset::CreateSubDatasetList( )
                 default:
                     break;
             }
+            szName[0] = '\0';
             nc_inq_varname( cdfid, nVar, szName);
+            nAttlen = 0;
             nc_inq_att( cdfid, nVar, CF_STD_NAME, &nAttype, &nAttlen);
-            if( nc_get_att_text ( cdfid, nVar, CF_STD_NAME, 
+            if( nAttlen < sizeof(szVarStdName) &&
+                nc_get_att_text ( cdfid, nVar, CF_STD_NAME, 
                                   szVarStdName ) == NC_NOERR ) {
                 szVarStdName[nAttlen] = '\0';
             }
@@ -4377,7 +4382,7 @@ GDALDataset *netCDFDataset::Open( GDALOpenInfo * poOpenInfo )
     int          *panBandZLev=NULL;
     int          *paDimIds=NULL;
     size_t       xdim, ydim;
-    char         szTemp[NC_MAX_NAME];
+    char         szTemp[NC_MAX_NAME+1];
 
     CPLString    osSubdatasetName;
     int          bTreatAsSubdataset;
@@ -4386,7 +4391,7 @@ GDALDataset *netCDFDataset::Open( GDALOpenInfo * poOpenInfo )
     char         *pszTemp = NULL;
     int          nIgnoredVars = 0;
 
-    char         szDimName[NC_MAX_NAME];
+    char         szDimName[NC_MAX_NAME+1];
     char         szExtraDimNames[NC_MAX_NAME];
     char         szExtraDimDef[NC_MAX_NAME];
     nc_type      nType=NC_NAT;
@@ -4593,13 +4598,20 @@ GDALDataset *netCDFDataset::Open( GDALOpenInfo * poOpenInfo )
     CPLDebug( "GDAL_netCDF", "dim_count = %d", dim_count );
 
     szConventions[0] = '\0';
-    if( (status = nc_get_att_text( cdfid, NC_GLOBAL, "Conventions",
+    nc_type nAttype=NC_NAT;
+    size_t nAttlen = 0;
+    nc_inq_att( cdfid, NC_GLOBAL, "Conventions", &nAttype, &nAttlen);
+    if( nAttlen >= sizeof(szConventions) ||
+        (status = nc_get_att_text( cdfid, NC_GLOBAL, "Conventions",
                                    szConventions )) != NC_NOERR ) {
         CPLError( CE_Warning, CPLE_AppDefined, 
                   "No UNIDATA NC_GLOBAL:Conventions attribute");
         /* note that 'Conventions' is always capital 'C' in CF spec*/
     }
-
+    else
+    {
+        szConventions[nAttlen] = '\0';
+    }
 
 /* -------------------------------------------------------------------- */
 /*      Create band information objects.                                */
@@ -4652,6 +4664,7 @@ GDALDataset *netCDFDataset::Open( GDALOpenInfo * poOpenInfo )
     for ( j = 0; j < nvars; j++ ) {
         nc_inq_varndims ( cdfid, j, &ndims );
         /* should we ignore this variable ? */
+        szTemp[0] = '\0';
         status = nc_inq_varname( cdfid, j, szTemp );
         if ( status == NC_NOERR && 
              ( CSLFindString( papszIgnoreVars, szTemp ) != -1 ) ) {
@@ -4688,7 +4701,7 @@ GDALDataset *netCDFDataset::Open( GDALOpenInfo * poOpenInfo )
 /* -------------------------------------------------------------------- */
     if( !bTreatAsSubdataset ) // nCount must be 1!
     {
-        char szVarName[NC_MAX_NAME];
+        char szVarName[NC_MAX_NAME+1];
         szVarName[0] = '\0';
         nc_inq_varname( cdfid, nVarID, szVarName);
         osSubdatasetName = szVarName;
@@ -4756,8 +4769,8 @@ GDALDataset *netCDFDataset::Open( GDALOpenInfo * poOpenInfo )
           != FALSE ) && EQUALN( szConventions, "CF", 2 );
 
     if ( bCheckDims ) {
-        char szDimName1[NC_MAX_NAME], szDimName2[NC_MAX_NAME], 
-            szDimName3[NC_MAX_NAME], szDimName4[NC_MAX_NAME];
+        char szDimName1[NC_MAX_NAME+1], szDimName2[NC_MAX_NAME+1], 
+            szDimName3[NC_MAX_NAME+1], szDimName4[NC_MAX_NAME+1];
         szDimName1[0]='\0';
         szDimName2[0]='\0';
         szDimName3[0]='\0';
@@ -5508,8 +5521,8 @@ netCDFDataset::CreateCopy( const char * pszFilename, GDALDataset *poSrcDS,
         CPLDebug( "GDAL_netCDF", "creating band # %d/%d nDim = %d",
                   iBand, nBands, nDim );
 
-        char szBandName[ NC_MAX_NAME ];
-        char szLongName[ NC_MAX_NAME ];
+        char szBandName[ NC_MAX_NAME+1 ];
+        char szLongName[ NC_MAX_NAME+1 ];
         const char *tmpMetadata;
         int bSignedData = TRUE;
         int  bNoDataSet;
@@ -5988,7 +6001,7 @@ int NCDFIsGDALVersionGTE(const char* pszVersion, int nTarget)
 
     papszTokens = CSLTokenizeString2( pszVersion+5, ".", 0 );
 
-    for ( int iToken = 0; papszTokens && papszTokens[iToken]; iToken++ )  {
+    for ( int iToken = 0; papszTokens && iToken < 4 && papszTokens[iToken]; iToken++ )  {
         nVersions[iToken] = atoi( papszTokens[iToken] );
     }
     if( nVersions[0] > 1 || nVersions[1] >= 10 )
@@ -6006,7 +6019,7 @@ void NCDFAddGDALHistory( int fpImage,
                          const char * pszFilename, const char *pszOldHist,
                          const char * pszFunctionName)
 {
-    char     szTemp[NC_MAX_NAME];
+    char     szTemp[NC_MAX_NAME+1];
 
     nc_put_att_text( fpImage, NC_GLOBAL, "Conventions", 
                      strlen(NCDF_CONVENTIONS_CF),
@@ -7059,7 +7072,6 @@ int NCDFIsVarTimeCoord( int nCdfId, int nVarId,
 char **NCDFTokenizeArray( const char *pszValue )
 {
     char **papszValues = NULL;
-    char *pszTemp = NULL;
     int nLen = 0;
 
     if ( pszValue==NULL || EQUAL( pszValue, "" ) ) 
@@ -7067,8 +7079,8 @@ char **NCDFTokenizeArray( const char *pszValue )
 
     nLen = strlen(pszValue);
 
-    if ( ( pszValue[0] == '{' ) && ( pszValue[nLen-1] == '}' ) ) {
-        pszTemp = (char *) CPLCalloc(nLen-2,sizeof(char*));
+    if ( pszValue[0] == '{' && nLen > 2 && pszValue[nLen-1] == '}' ) {
+        char *pszTemp = reinterpret_cast<char *> (CPLMalloc( (nLen-2) + 1 ) );
         strncpy( pszTemp, pszValue+1, nLen-2);
         pszTemp[nLen-2] = '\0';
         papszValues = CSLTokenizeString2( pszTemp, ",", CSLT_ALLOWEMPTYTOKENS );
diff --git a/frmts/nitf/ecrgtocdataset.cpp b/frmts/nitf/ecrgtocdataset.cpp
index ff596e7..26af804 100644
--- a/frmts/nitf/ecrgtocdataset.cpp
+++ b/frmts/nitf/ecrgtocdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ecrgtocdataset.cpp 29778 2015-08-25 09:02:53Z rouault $
+ * $Id: ecrgtocdataset.cpp 32232 2015-12-18 12:30:37Z rouault $
  *
  * Project:  ECRG TOC read Translator
  * Purpose:  Implementation of ECRGTOCDataset and ECRGTOCSubDataset.
@@ -35,7 +35,7 @@
 #include "cpl_minixml.h"
 #include <vector>
 
-CPL_CVSID("$Id: ecrgtocdataset.cpp 29778 2015-08-25 09:02:53Z rouault $");
+CPL_CVSID("$Id: ecrgtocdataset.cpp 32232 2015-12-18 12:30:37Z rouault $");
 
 /** Overview of used classes :
    - ECRGTOCDataset : lists the different subdatasets, listed in the .xml,
@@ -261,9 +261,9 @@ static GIntBig GetFromBase34(const char* pszVal, int nMaxSize)
             chVal = ch - '0';
         else if (ch >= 'a' && ch <= 'h')
             chVal = ch - 'a' + 10;
-        else if (ch >= 'j' && ch < 'n')
+        else if (ch >= 'j' && ch <= 'n')
             chVal = ch - 'a' + 10 - 1;
-        else if (ch > 'p' && ch <= 'z')
+        else if (ch >= 'p' && ch <= 'z')
             chVal = ch - 'a' + 10 - 2;
         else
         {
@@ -1058,7 +1058,7 @@ GDALDataset *ECRGTOCDataset::Open( GDALOpenInfo * poOpenInfo )
             {
                 osFilename = papszTokens[2];
                 osFilename += ":";
-                osFilename = papszTokens[3];
+                osFilename += papszTokens[3];
             }
             else
             {
@@ -1074,7 +1074,7 @@ GDALDataset *ECRGTOCDataset::Open( GDALOpenInfo * poOpenInfo )
             osScale = papszTokens[2];
             osFilename = papszTokens[3];
             osFilename += ":";
-            osFilename = papszTokens[4];
+            osFilename += papszTokens[4];
         }
         else
         {
diff --git a/frmts/nitf/nitffile.c b/frmts/nitf/nitffile.c
index 3f59b29..11719e7 100644
--- a/frmts/nitf/nitffile.c
+++ b/frmts/nitf/nitffile.c
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: nitffile.c 28039 2014-11-30 18:24:59Z rouault $
+ * $Id: nitffile.c 32465 2015-12-26 09:11:29Z rouault $
  *
  * Project:  NITF Read/Write Library
  * Purpose:  Module responsible for opening NITF file, populating NITFFile
@@ -34,7 +34,7 @@
 #include "cpl_conv.h"
 #include "cpl_string.h"
 
-CPL_CVSID("$Id: nitffile.c 28039 2014-11-30 18:24:59Z rouault $");
+CPL_CVSID("$Id: nitffile.c 32465 2015-12-26 09:11:29Z rouault $");
 
 static int NITFWriteBLOCKA( VSILFILE* fp, vsi_l_offset nOffsetUDIDL,
                             int *pnOffset,
@@ -2139,19 +2139,31 @@ static char** NITFGenericMetadataReadTREInternal(char **papszMD,
                 const char* pszLengthVar = CPLGetXMLValue(psIter, "length_var", NULL);
                 if (pszLengthVar != NULL)
                 {
-                    char** papszMDIter = papszMD;
-                    while(papszMDIter != NULL && *papszMDIter != NULL)
+                    // Preferably look for item at the same level as ours.
+                    const char* pszLengthValue =
+                        CSLFetchNameValue( papszMD,  CPLSPrintf("%s%s", pszMDPrefix, pszLengthVar) );
+                    if( pszLengthValue != NULL )
                     {
-                        if (strstr(*papszMDIter, pszLengthVar) != NULL)
+                        nLength = atoi(pszLengthValue);
+                    }
+                    else
+                    {
+                        char** papszMDIter = papszMD;
+                        while(papszMDIter != NULL && *papszMDIter != NULL)
                         {
-                            const char* pszEqual = strchr(*papszMDIter, '=');
-                            if (pszEqual != NULL)
+                            if (strstr(*papszMDIter, pszLengthVar) != NULL)
                             {
-                                nLength = atoi(pszEqual + 1);
-                                break;
+                                const char* pszEqual = strchr(*papszMDIter, '=');
+                                if (pszEqual != NULL)
+                                {
+                                    nLength = atoi(pszEqual + 1);
+                                    // Voluntary missing break so as to find the
+                                    // "closest" item to ours in case it is not
+                                    // defined in the same level
+                                }
                             }
+                            papszMDIter ++;
                         }
-                        papszMDIter ++;
                     }
                 }
             }
diff --git a/frmts/pdf/pdfdataset.cpp b/frmts/pdf/pdfdataset.cpp
index 28e3e89..309018f 100644
--- a/frmts/pdf/pdfdataset.cpp
+++ b/frmts/pdf/pdfdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: pdfdataset.cpp 29846 2015-08-27 15:29:32Z rouault $
+ * $Id: pdfdataset.cpp 32773 2016-01-06 11:24:07Z rouault $
  *
  * Project:  PDF driver
  * Purpose:  GDALDataset driver for PDF dataset.
@@ -48,7 +48,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 29846 2015-08-27 15:29:32Z rouault $");
+CPL_CVSID("$Id: pdfdataset.cpp 32773 2016-01-06 11:24:07Z rouault $");
 
 CPL_C_START
 void    GDALRegister_PDF(void);
@@ -4433,16 +4433,31 @@ int PDFDataset::ParseProjDict(GDALPDFDictionary* poProjDict)
 /* -------------------------------------------------------------------- */
     CPLString osUnits;
     GDALPDFObject* poUnits;
-    if ((poUnits = poProjDict->Get("Units")) != NULL &&
-        poUnits->GetType() == PDFObjectType_String)
+    if( (poUnits = poProjDict->Get("Units")) != NULL &&
+        poUnits->GetType() == PDFObjectType_String &&
+        !EQUAL(osProjectionType, "GEOGRAPHIC") )
     {
         osUnits = poUnits->GetString();
         CPLDebug("PDF", "Projection.Units = %s", osUnits.c_str());
 
+        // This is super weird. The false easting/northing of the SRS
+        // are expressed in the unit, but the geotransform is expressed in
+        // meters. Hence this hack to have an equivalent SRS definition, but
+        // with linear units converted in meters.
         if (EQUAL(osUnits, "M"))
             oSRS.SetLinearUnits( "Meter", 1.0 );
         else if (EQUAL(osUnits, "FT"))
+        {
             oSRS.SetLinearUnits( "foot", 0.3048 );
+            oSRS.SetLinearUnitsAndUpdateParameters( "Meter", 1.0 );
+        }
+        else if (EQUAL(osUnits, "USSF"))
+        {
+            oSRS.SetLinearUnits( SRS_UL_US_FOOT, CPLAtof(SRS_UL_US_FOOT_CONV) );
+            oSRS.SetLinearUnitsAndUpdateParameters( "Meter", 1.0 );
+        }
+        else
+            CPLError(CE_Warning, CPLE_AppDefined, "Unhandled unit: %s", osUnits.c_str());
     }
 
 /* -------------------------------------------------------------------- */
diff --git a/frmts/pds/frmt_pds.html b/frmts/pds/frmt_pds.html
index 973cef5..16f4b86 100644
--- a/frmts/pds/frmt_pds.html
+++ b/frmts/pds/frmt_pds.html
@@ -22,12 +22,41 @@ as well as selected other header metadata.<p>
 Implementation of this driver was supported by the United States
 Geological Survey.<p>
 
-Due to abiguitities in the PDS specification, the georeferencing of 
+<hr>
+
+Due to ambiguities in the PDS specification, the georeferencing of 
 some products is subtly or grossly incorrect.  There are configuration
 variables which may be set for these products to correct the interpretation
 of the georeferencing.  Some details are available in 
 <a href="http://trac.osgeo.org/gdal/ticket/3940">ticket #3940</a>.<p>
 
+For example, the MOLA labels currently contain a one pixel offset. Once 
+<a href="http://trac.osgeo.org/gdal/ticket/5941">ticket #5941</a> is applied (should be available post 1.11.3), 
+which corrects the PDS offset defaults, here is how you can correctly read in
+a MOLA label using the --config options in the PDS reader.
+<p>
+$ gdalinfo  --config PDS_SampleProjOffset_Shift -0.5 --config PDS_LineProjOffset_Shift -0.5  mola.lbl
+<p>
+For LOLA global PDS files the center should be perfectly 0.0, 0.0 meters in Cartesian space.
+
+example conversion:<p>
+$ gdal_translate --config PDS_SampleProjOffset_Shift -0.5 --config PDS_LineProjOffset_Shift -0.5  mola.lbl out.tif
+<p>
+example conversion and applying offset and multiplier values as defined in some PDS labels:<p>
+$ gdal_translate -ot Float32 -unscale  --config PDS_SampleProjOffset_Shift -0.5 --config PDS_LineProjOffset_Shift -0.5  mola.lbl out_32bit.tif
+<p>
+As a test, this lunar
+<a href="http://pds-geosciences.wustl.edu/lro/lro-l-lola-3-rdr-v1/lrolol_1xxx/data/lola_gdr/cylindrical/img/ldem_4.lbl">LOLA PDS label</a>
+should be perfectly centered at 0.0, 0.0 meters in Cartesian space without any configuration options. Remember you will need a GDAL version post 1.11.3.<p>
+$ gdalinfo  ldem_4.lbl
+<p>
+To test the --config keyword above, this Mars <a href="http://pds-geosciences.wustl.edu/mgs/mgs-m-mola-5-megdr-l3-v1/mgsl_300x/meg004/megt90n000cb.lbl">MOLA PDS label</a>
+should be perfectly centered at 0.0, 0.0 meters in Cartesian space with the following configuration options. Remember you will need a GDAL version post 1.11.3.<p>
+$ gdalinfo  --config PDS_SampleProjOffset_Shift -0.5 --config PDS_LineProjOffset_Shift -0.5  megt90n000cb.lbl
+<p>
+
+<p>
+<hr>
 
 PDS is part of a family of related formats including ISIS2 and ISIS3.<p>
 
diff --git a/frmts/pds/pdsdataset.cpp b/frmts/pds/pdsdataset.cpp
index f569f24..d3db245 100644
--- a/frmts/pds/pdsdataset.cpp
+++ b/frmts/pds/pdsdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: pdsdataset.cpp 29625 2015-08-07 20:38:54Z rouault $
+ * $Id: pdsdataset.cpp 30712 2015-09-26 08:06:35Z rouault $
  *
  * Project:  PDS Driver; Planetary Data System Format
  * Purpose:  Implementation of PDSDataset
@@ -47,7 +47,7 @@
 #include "cpl_string.h" 
 #include "nasakeywordhandler.h"
 
-CPL_CVSID("$Id: pdsdataset.cpp 29625 2015-08-07 20:38:54Z rouault $");
+CPL_CVSID("$Id: pdsdataset.cpp 30712 2015-09-26 08:06:35Z rouault $");
 
 CPL_C_START
 void	GDALRegister_PDS(void);
@@ -357,11 +357,13 @@ void PDSDataset::ParseSRS()
     double   dfSampleOffset_Mult;
     double   dfLineOffset_Mult;
 
+    /* See https://trac.osgeo.org/gdal/ticket/5941 for the history of the default */
+    /* value of PDS_SampleProjOffset_Shift and PDS_LineProjOffset_Shift */
     dfSampleOffset_Shift = 
-        CPLAtof(CPLGetConfigOption( "PDS_SampleProjOffset_Shift", "-0.5" ));
+        CPLAtof(CPLGetConfigOption( "PDS_SampleProjOffset_Shift", "0.5" ));
     
     dfLineOffset_Shift = 
-        CPLAtof(CPLGetConfigOption( "PDS_LineProjOffset_Shift", "-0.5" ));
+        CPLAtof(CPLGetConfigOption( "PDS_LineProjOffset_Shift", "0.5" ));
 
     dfSampleOffset_Mult =
         CPLAtof(CPLGetConfigOption( "PDS_SampleProjOffset_Mult", "-1.0") );
diff --git a/frmts/pds/vicardataset.cpp b/frmts/pds/vicardataset.cpp
index e110612..a0b725e 100644
--- a/frmts/pds/vicardataset.cpp
+++ b/frmts/pds/vicardataset.cpp
@@ -43,7 +43,7 @@
 
 #include <string>
 
-CPL_CVSID("$Id: vicardataset.cpp 28786 2015-03-26 21:13:18Z rouault $");
+CPL_CVSID("$Id: vicardataset.cpp 31757 2015-11-25 13:54:13Z rouault $");
 
 CPL_C_START
 void GDALRegister_VICAR(void);
@@ -339,10 +339,10 @@ GDALDataset *VICARDataset::Open( GDALOpenInfo * poOpenInfo )
     double   dfLineOffset_Mult;
     
     dfSampleOffset_Shift = 
-        CPLAtof(CPLGetConfigOption( "PDS_SampleProjOffset_Shift", "-0.5" ));
+        CPLAtof(CPLGetConfigOption( "PDS_SampleProjOffset_Shift", "0.5" ));
     
     dfLineOffset_Shift = 
-        CPLAtof(CPLGetConfigOption( "PDS_LineProjOffset_Shift", "-0.5" ));
+        CPLAtof(CPLGetConfigOption( "PDS_LineProjOffset_Shift", "0.5" ));
 
     dfSampleOffset_Mult =
         CPLAtof(CPLGetConfigOption( "PDS_SampleProjOffset_Mult", "-1.0") );
diff --git a/frmts/pds/vicarkeywordhandler.cpp b/frmts/pds/vicarkeywordhandler.cpp
index 8cc1100..fda85a2 100644
--- a/frmts/pds/vicarkeywordhandler.cpp
+++ b/frmts/pds/vicarkeywordhandler.cpp
@@ -73,24 +73,27 @@ int VICARKeywordHandler::Ingest( VSILFILE *fp, GByte *pabyHeader )
     if( VSIFSeekL( fp, 0, SEEK_SET ) != 0 )
         return FALSE;
 
-    char *pch1, *pch2;
-    char keyval[100];
-
     // Find LBLSIZE Entry
-    char* pszLBLSIZE=strstr((char*)pabyHeader,"LBLSIZE");
+    char* pszLBLSIZE = strstr(reinterpret_cast<char *>( pabyHeader ), "LBLSIZE");
     int nOffset = 0;
 
     if (pszLBLSIZE)
-        nOffset = pszLBLSIZE - (const char *)pabyHeader;
-    pch1=strstr((char*)pabyHeader+nOffset,"=");
-    if( pch1 == NULL ) return FALSE;
-    pch1 ++;
-    pch2=strstr((char*)pabyHeader+nOffset," ");
-    if( pch2 == NULL ) return FALSE;
-    strncpy(keyval,pch1,MAX(pch2-pch1, 99));
-    keyval[MAX(pch2-pch1, 99)] = 0;
-    LabelSize=atoi(keyval);    
-    if( LabelSize > 10 * 1024 * 124 )
+        nOffset = static_cast<int>(pszLBLSIZE - (const char *)pabyHeader);
+
+    const char *pch1 = strstr(reinterpret_cast<char *>( pabyHeader + nOffset ), "=");
+    if( pch1 == NULL )
+        return FALSE;
+
+    ++pch1;
+    const char *pch2 = strstr(pch1, " ");
+    if( pch2 == NULL )
+        return FALSE;
+
+    char keyval[100];
+    strncpy( keyval, pch1, MIN( static_cast<size_t>(pch2-pch1), sizeof(keyval)-1 ) );
+    keyval[MIN( static_cast<size_t>(pch2-pch1), sizeof(keyval)-1 )] = '\0';
+    LabelSize = atoi( keyval );
+    if( LabelSize <= 0 || LabelSize > 10 * 1024 * 124 )
         return FALSE;
 
     char* pszChunk = (char*) VSIMalloc(LabelSize+1);
@@ -146,7 +149,7 @@ int VICARKeywordHandler::Ingest( VSILFILE *fp, GByte *pabyHeader )
     nBandOffset = nLineOffset * nRows;
     long int starteol = LabelSize + nBandOffset * nBands;
     if( VSIFSeekL( fp, starteol, SEEK_SET ) != 0 ) {
-        printf("Error seeking to EOL!\n");
+        CPLError(CE_Failure, CPLE_AppDefined, "Error seeking again to EOL!");
         return FALSE;
         }
     char szChunk[100];
@@ -156,15 +159,25 @@ int VICARKeywordHandler::Ingest( VSILFILE *fp, GByte *pabyHeader )
     nOffset=0;
     
     if (pszLBLSIZE)
-        nOffset = pszLBLSIZE - (const char *)szChunk;
-    pch1=strstr((char*)szChunk+nOffset,"=")+1;
-    pch2=strstr((char*)szChunk+nOffset," ");
-    strncpy(keyval,pch1,pch2-pch1);
-    int EOLabelSize=atoi(keyval);
-    if( EOLabelSize > 99 )
-        EOLabelSize = 99;
-    if( VSIFSeekL( fp, starteol, SEEK_SET ) != 0 ) {
-        printf("Error seeking again to EOL!\n");
+        nOffset = static_cast<int>(pszLBLSIZE - (const char *)szChunk);
+    pch1 = strstr( reinterpret_cast<char *>( szChunk + nOffset ), "=" );
+    if( pch1 == NULL )
+        return FALSE;
+    pch1 ++;
+    pch2 = strstr( pch1, " " );
+    if( pch2 == NULL )
+        return FALSE;
+    strncpy( keyval, pch1, MIN( static_cast<size_t>(pch2-pch1), sizeof(keyval)-1 ) );
+    keyval[MIN( static_cast<size_t>(pch2-pch1), sizeof(keyval)-1 )] = '\0';
+
+    int EOLabelSize = atoi( keyval );
+    if( EOLabelSize <= 0 )
+        return FALSE;
+    if( EOLabelSize > static_cast<int>(sizeof(szChunk) - 1) )
+        EOLabelSize = static_cast<int>(sizeof(szChunk) - 1);
+    if( VSIFSeekL( fp, starteol, SEEK_SET ) != 0 )
+    {
+        CPLError(CE_Failure, CPLE_AppDefined, "Error seeking again to EOL!");
         return FALSE;
         }
     nBytesRead = VSIFReadL( szChunk, 1, EOLabelSize, fp );
@@ -237,8 +250,8 @@ int VICARKeywordHandler::ReadPair( CPLString &osName, CPLString &osValue ) {
         while( ReadWord( osWord ) )
         {
             osValue += osWord;
-            if ( strlen(osWord) < 2 ) continue;
-            if( osWord[strlen(osWord)-1] == ')' && osWord[strlen(osWord)-2] == '\'' ) break;
+            if ( osWord.size() < 2 ) continue;
+            if( osWord[osWord.size()-1] == ')' && osWord[osWord.size()-2] == '\'' ) break;
         }
     }
 
@@ -251,7 +264,7 @@ int VICARKeywordHandler::ReadPair( CPLString &osName, CPLString &osValue ) {
             SkipWhite();
 
             osValue += osWord;
-            if( osWord[strlen(osWord)-1] == ')'  ) break;
+            if( osWord.size() && osWord[osWord.size()-1] == ')'  ) break;
         }
     }
 
@@ -287,11 +300,22 @@ int VICARKeywordHandler::ReadWord( CPLString &osWord )
     if( *pszHeaderNext == '\'' )
     {
         pszHeaderNext++;
-        while( *pszHeaderNext != '\'' )
+        while( true )
         {
-            //Skip Double Quotes
-                        if( *pszHeaderNext+1 == '\'' ) continue;
-            osWord += *(pszHeaderNext++);
+            if( *pszHeaderNext == '\0' )
+                return FALSE;
+            if( *(pszHeaderNext) == '\'' )
+            {
+                if( *(pszHeaderNext+1) == '\'' )
+                {
+                    //Skip Double Quotes
+                    pszHeaderNext++;
+                }
+                else
+                    break;
+            }
+            osWord += *pszHeaderNext;
+            pszHeaderNext++;
         }
         pszHeaderNext++;
         return TRUE;
@@ -299,6 +323,8 @@ int VICARKeywordHandler::ReadWord( CPLString &osWord )
 
     while( *pszHeaderNext != '=' && !isspace((unsigned char)*pszHeaderNext) )
     {
+        if( *pszHeaderNext == '\0' )
+            return FALSE;
         osWord += *pszHeaderNext;
         pszHeaderNext++;
 
diff --git a/frmts/raw/btdataset.cpp b/frmts/raw/btdataset.cpp
index 0044a23..a15b64e 100644
--- a/frmts/raw/btdataset.cpp
+++ b/frmts/raw/btdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: btdataset.cpp 29284 2015-06-03 13:26:10Z rouault $
+ * $Id: btdataset.cpp 30887 2015-10-07 15:52:20Z rouault $
  *
  * Project:  VTP .bt Driver
  * Purpose:  Implementation of VTP .bt elevation format read/write support.
@@ -32,7 +32,7 @@
 #include "rawdataset.h"
 #include "ogr_spatialref.h"
 
-CPL_CVSID("$Id: btdataset.cpp 29284 2015-06-03 13:26:10Z rouault $");
+CPL_CVSID("$Id: btdataset.cpp 30887 2015-10-07 15:52:20Z rouault $");
 
 CPL_C_START
 void    GDALRegister_BT(void);
diff --git a/frmts/usgsdem/usgsdem_create.cpp b/frmts/usgsdem/usgsdem_create.cpp
index 3f6edae..5b77118 100644
--- a/frmts/usgsdem/usgsdem_create.cpp
+++ b/frmts/usgsdem/usgsdem_create.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: usgsdem_create.cpp 28785 2015-03-26 20:46:45Z goatbar $
+ * $Id: usgsdem_create.cpp 32029 2015-12-06 14:38:26Z rouault $
  *
  * Project:  USGS DEM Driver
  * Purpose:  CreateCopy() implementation.
@@ -37,7 +37,7 @@
 #include "gdalwarper.h"
 #include "cpl_csv.h"
 
-CPL_CVSID("$Id: usgsdem_create.cpp 28785 2015-03-26 20:46:45Z goatbar $");
+CPL_CVSID("$Id: usgsdem_create.cpp 32029 2015-12-06 14:38:26Z rouault $");
 
 typedef struct 
 {
@@ -183,9 +183,13 @@ static void USGSDEMPrintDouble( char *pszBuffer, double dfValue )
 
     if ( !pszBuffer )
         return;
-
+    int nOffset = 0;
 #if defined(HAVE_SNPRINTF)
-    CPLsnprintf( szTemp, DOUBLE_BUFFER_SIZE, pszFormat, dfValue );
+    if( CPLsnprintf( szTemp, DOUBLE_BUFFER_SIZE, pszFormat, dfValue ) == 25 &&
+        szTemp[0] == ' ' )
+    {
+        nOffset = 1;
+    }
 #else
     CPLsprintf( szTemp, pszFormat, dfValue );
 #endif
@@ -207,7 +211,7 @@ static void USGSDEMPrintDouble( char *pszBuffer, double dfValue )
 #endif
     }
 
-    TextFillR( pszBuffer, 24, szTemp );
+    TextFillR( pszBuffer, 24, szTemp + nOffset );
 }
 
 /************************************************************************/
@@ -233,9 +237,13 @@ static void USGSDEMPrintSingle( char *pszBuffer, double dfValue )
 
     if ( !pszBuffer )
         return;
-
+    int nOffset = 0;
 #if defined(HAVE_SNPRINTF)
-    CPLsnprintf( szTemp, DOUBLE_BUFFER_SIZE, pszFormat, dfValue );
+    if( CPLsnprintf( szTemp, DOUBLE_BUFFER_SIZE, pszFormat, dfValue ) == 13 &&
+        szTemp[0] == ' ' )
+    {
+        nOffset = 1;
+    }
 #else
     CPLsprintf( szTemp, pszFormat, dfValue );
 #endif
@@ -257,7 +265,7 @@ static void USGSDEMPrintSingle( char *pszBuffer, double dfValue )
 #endif
     }
 
-    TextFillR( pszBuffer, 12, szTemp );
+    TextFillR( pszBuffer, 12, szTemp + nOffset );
 }
 
 /************************************************************************/
diff --git a/frmts/vrt/vrtdataset.cpp b/frmts/vrt/vrtdataset.cpp
index 41a2a45..d851c5d 100644
--- a/frmts/vrt/vrtdataset.cpp
+++ b/frmts/vrt/vrtdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: vrtdataset.cpp 29616 2015-08-06 10:07:50Z rouault $
+ * $Id: vrtdataset.cpp 32756 2016-01-05 16:03:53Z rouault $
  *
  * Project:  Virtual GDAL Datasets
  * Purpose:  Implementation of VRTDataset
@@ -33,7 +33,7 @@
 #include "cpl_minixml.h"
 #include "ogr_spatialref.h"
 
-CPL_CVSID("$Id: vrtdataset.cpp 29616 2015-08-06 10:07:50Z rouault $");
+CPL_CVSID("$Id: vrtdataset.cpp 32756 2016-01-05 16:03:53Z rouault $");
 
 /************************************************************************/
 /*                            VRTDataset()                             */
@@ -864,7 +864,6 @@ CPLErr VRTDataset::AddBand( GDALDataType eType, char **papszOptions )
     if( pszSubClass != NULL && EQUAL(pszSubClass,"VRTRawRasterBand") )
     {
         int nWordDataSize = GDALGetDataTypeSize( eType ) / 8;
-        vsi_l_offset nImageOffset = 0;
         int nPixelOffset = nWordDataSize;
         int nLineOffset = nWordDataSize * GetRasterXSize();
         const char *pszFilename;
@@ -874,9 +873,9 @@ CPLErr VRTDataset::AddBand( GDALDataType eType, char **papszOptions )
 /* -------------------------------------------------------------------- */
 /*      Collect required information.                                   */
 /* -------------------------------------------------------------------- */
-        if( CSLFetchNameValue(papszOptions, "ImageOffset") != NULL )
-            nImageOffset = CPLScanUIntBig(
-                CSLFetchNameValue(papszOptions, "ImageOffset"), 20);
+        const char* pszImageOffset = CSLFetchNameValueDef(papszOptions, "ImageOffset", "0");
+        vsi_l_offset nImageOffset = CPLScanUIntBig(
+                                    pszImageOffset, strlen(pszImageOffset));
 
         if( CSLFetchNameValue(papszOptions, "PixelOffset") != NULL )
             nPixelOffset = atoi(CSLFetchNameValue(papszOptions,"PixelOffset"));
diff --git a/frmts/vrt/vrtrasterband.cpp b/frmts/vrt/vrtrasterband.cpp
index 3936f05..4be9ccb 100644
--- a/frmts/vrt/vrtrasterband.cpp
+++ b/frmts/vrt/vrtrasterband.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: vrtrasterband.cpp 29038 2015-04-28 09:03:36Z rouault $
+ * $Id: vrtrasterband.cpp 31003 2015-10-14 16:19:20Z rouault $
  *
  * Project:  Virtual GDAL Datasets
  * Purpose:  Implementation of VRTRasterBand
@@ -32,7 +32,7 @@
 #include "cpl_minixml.h"
 #include "cpl_string.h"
 
-CPL_CVSID("$Id: vrtrasterband.cpp 29038 2015-04-28 09:03:36Z rouault $");
+CPL_CVSID("$Id: vrtrasterband.cpp 31003 2015-10-14 16:19:20Z rouault $");
 
 /************************************************************************/
 /* ==================================================================== */
@@ -552,7 +552,7 @@ CPLXMLNode *VRTRasterBand::SerializeToXML( const char *pszVRTPath )
             CPLSetXMLValue( psTree, "NoDataValue", "nan");
         else
             CPLSetXMLValue( psTree, "NoDataValue", 
-                            CPLSPrintf( "%.14E", dfNoDataValue ) );
+                            CPLSPrintf( "%.16g", dfNoDataValue ) );
     }
     
     if( bHideNoDataValue )
diff --git a/frmts/vrt/vrtrawrasterband.cpp b/frmts/vrt/vrtrawrasterband.cpp
index 7b69da7..cf1c1e7 100644
--- a/frmts/vrt/vrtrawrasterband.cpp
+++ b/frmts/vrt/vrtrawrasterband.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: vrtrawrasterband.cpp 28053 2014-12-04 09:31:07Z rouault $
+ * $Id: vrtrawrasterband.cpp 32756 2016-01-05 16:03:53Z rouault $
  *
  * Project:  Virtual GDAL Datasets
  * Purpose:  Implementation of VRTRawRasterBand
@@ -33,7 +33,7 @@
 #include "cpl_string.h"
 #include "rawdataset.h"
 
-CPL_CVSID("$Id: vrtrawrasterband.cpp 28053 2014-12-04 09:31:07Z rouault $");
+CPL_CVSID("$Id: vrtrawrasterband.cpp 32756 2016-01-05 16:03:53Z rouault $");
 
 /************************************************************************/
 /* ==================================================================== */
@@ -329,12 +329,12 @@ CPLErr VRTRawRasterBand::XMLInit( CPLXMLNode * psTree,
 /* -------------------------------------------------------------------- */
 /*      Collect layout information.                                     */
 /* -------------------------------------------------------------------- */
-    vsi_l_offset nImageOffset;
     int nPixelOffset, nLineOffset;
     int nWordDataSize = GDALGetDataTypeSize( GetRasterDataType() ) / 8;
 
-    nImageOffset = CPLScanUIntBig(
-        CPLGetXMLValue( psTree, "ImageOffset", "0"), 20);
+    const char* pszImageOffset = CPLGetXMLValue( psTree, "ImageOffset", "0");
+    const vsi_l_offset nImageOffset = CPLScanUIntBig(
+                                    pszImageOffset, strlen(pszImageOffset));
 
     if( CPLGetXMLValue( psTree, "PixelOffset", NULL ) == NULL )
         nPixelOffset = nWordDataSize;
diff --git a/frmts/vrt/vrtsources.cpp b/frmts/vrt/vrtsources.cpp
index 9738fea..12272be 100644
--- a/frmts/vrt/vrtsources.cpp
+++ b/frmts/vrt/vrtsources.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: vrtsources.cpp 29326 2015-06-10 20:36:31Z rouault $
+ * $Id: vrtsources.cpp 31003 2015-10-14 16:19:20Z rouault $
  *
  * Project:  Virtual GDAL Datasets
  * Purpose:  Implementation of VRTSimpleSource, VRTFuncSource and 
@@ -43,7 +43,7 @@
 #define isnan std::isnan
 #endif
 
-CPL_CVSID("$Id: vrtsources.cpp 29326 2015-06-10 20:36:31Z rouault $");
+CPL_CVSID("$Id: vrtsources.cpp 31003 2015-10-14 16:19:20Z rouault $");
 
 /************************************************************************/
 /* ==================================================================== */
@@ -1603,7 +1603,7 @@ CPLXMLNode *VRTComplexSource::SerializeToXML( const char *pszVRTPath )
             CPLSetXMLValue( psSrc, "NODATA", "nan");
         else
             CPLSetXMLValue( psSrc, "NODATA", 
-                            CPLSPrintf("%g", dfNoDataValue) );
+                            CPLSPrintf("%.16g", dfNoDataValue) );
     }
         
     switch( eScalingType )
diff --git a/frmts/wms/wmsdriver.cpp b/frmts/wms/wmsdriver.cpp
index 54cfca4..cef3591 100644
--- a/frmts/wms/wmsdriver.cpp
+++ b/frmts/wms/wmsdriver.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: wmsdriver.cpp 28911 2015-04-15 14:46:06Z bishop $
+ * $Id: wmsdriver.cpp 31240 2015-10-29 03:32:45Z rouault $
  *
  * Project:  WMS Client Driver
  * Purpose:  Implementation of Dataset and RasterBand classes for WMS
@@ -585,6 +585,15 @@ static CPLXMLNode* GDALWMSDatasetGetConfigFromArcGISJSON(const char* pszURL,
         dfMaxX = 180;
     }
 
+    const int nLevelCountOri = nLevelCount;
+    while( (double)nTileCountX * nTileWidth * (1 << nLevelCount) > INT_MAX )
+        nLevelCount --;
+    while( (double)nTileHeight * (1 << nLevelCount) > INT_MAX )
+        nLevelCount --;
+    if( nLevelCount != nLevelCountOri )
+        CPLDebug("WMS", "Had to limit level count to %d instead of %d to stay within GDAL raster size limits",
+                 nLevelCount, nLevelCountOri);
+
     CPLString osXML = CPLSPrintf(
             "<GDAL_WMS>\n"
             "  <Service name=\"TMS\">\n"
diff --git a/frmts/xpm/xpmdataset.cpp b/frmts/xpm/xpmdataset.cpp
index bec7664..d972905 100644
--- a/frmts/xpm/xpmdataset.cpp
+++ b/frmts/xpm/xpmdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: xpmdataset.cpp 28785 2015-03-26 20:46:45Z goatbar $
+ * $Id: xpmdataset.cpp 31998 2015-12-04 20:03:08Z rouault $
  *
  * Project:  XPM Driver
  * Purpose:  Implement GDAL XPM Support
@@ -34,9 +34,10 @@
 #include "gdal_frmts.h"						      
 
 
-CPL_CVSID("$Id: xpmdataset.cpp 28785 2015-03-26 20:46:45Z goatbar $");
+CPL_CVSID("$Id: xpmdataset.cpp 31998 2015-12-04 20:03:08Z rouault $");
 
 static unsigned char *ParseXPM( const char *pszInput,
+                                unsigned int nFileSize,
                                 int *pnXSize, int *pnYSize, 
                                 GDALColorTable **ppoRetTable );
 
@@ -148,7 +149,7 @@ GDALDataset *XPMDataset::Open( GDALOpenInfo * poOpenInfo )
 
     CPLErrorReset();
 
-    pabyImage = ParseXPM( pszFileContents, &nXSize, &nYSize, &poCT );
+    pabyImage = ParseXPM( pszFileContents, nFileSize, &nXSize, &nYSize, &poCT );
     CPLFree( pszFileContents );
 
     if( pabyImage == NULL )
@@ -452,7 +453,9 @@ void GDALRegister_XPM()
 /************************************************************************/
 
 static unsigned char *
-ParseXPM( const char *pszInput, int *pnXSize, int *pnYSize, 
+ParseXPM( const char *pszInput,
+          unsigned int nFileSize,
+          int *pnXSize, int *pnYSize, 
           GDALColorTable **ppoRetTable )
 
 {
@@ -528,7 +531,9 @@ ParseXPM( const char *pszInput, int *pnXSize, int *pnYSize,
     int nColorCount, nCharsPerPixel;
 
     if( sscanf( papszXPMList[0], "%d %d %d %d", 
-                pnXSize, pnYSize, &nColorCount, &nCharsPerPixel ) != 4 )
+                pnXSize, pnYSize, &nColorCount, &nCharsPerPixel ) != 4 ||
+        *pnXSize <= 0 || *pnYSize <= 0 || nColorCount <= 0 || nColorCount > 256 ||
+        static_cast<GUIntBig>(*pnXSize) * static_cast<GUIntBig>(*pnYSize) > nFileSize )
     {
         CPLError( CE_Failure, CPLE_AppDefined,
                   "Image definition (%s) not well formed.",
@@ -557,6 +562,15 @@ ParseXPM( const char *pszInput, int *pnXSize, int *pnYSize,
 
     for( iColor = 0; iColor < nColorCount; iColor++ )
     {
+        if( papszXPMList[iColor+1] == NULL )
+        {
+            CPLError( CE_Failure, CPLE_AppDefined, 
+                      "Missing color definition for %d in XPM header.", 
+                      iColor+1 );
+            CSLDestroy( papszXPMList );
+            return NULL;
+        }
+
         char **papszTokens = CSLTokenizeString( papszXPMList[iColor+1]+1 );
         GDALColorEntry sColor;
         int            nRed, nGreen, nBlue;
@@ -571,7 +585,7 @@ ParseXPM( const char *pszInput, int *pnXSize, int *pnYSize,
             return NULL;
         }
 
-        anCharLookup[(int)papszXPMList[iColor+1][0]] = iColor;
+        anCharLookup[*(reinterpret_cast<GByte*>(papszXPMList[iColor+1]))] = iColor;
         
         if( EQUAL(papszTokens[1],"None") )
         {
@@ -625,9 +639,10 @@ ParseXPM( const char *pszInput, int *pnXSize, int *pnYSize,
 /* -------------------------------------------------------------------- */
     for( int iLine = 0; iLine < *pnYSize; iLine++ )
     {
-        const char *pszInLine = papszXPMList[iLine + nColorCount + 1];
+        const GByte *pabyInLine = reinterpret_cast<GByte*>(
+                                papszXPMList[iLine + nColorCount + 1]);
 
-        if( pszInLine == NULL )
+        if( pabyInLine == NULL )
         {
             CPLFree( pabyImage );
             CSLDestroy( papszXPMList );
@@ -636,11 +651,12 @@ ParseXPM( const char *pszInput, int *pnXSize, int *pnYSize,
             return NULL;
         }
 
-        for( int iPixel = 0; 
-             pszInLine[iPixel] != '\0' && iPixel < *pnXSize; 
+        for( int iPixel = 0;
+             pabyInLine[iPixel] != '\0' && iPixel < *pnXSize;
              iPixel++ )
         {
-            int nPixelValue = anCharLookup[(int)pszInLine[iPixel]];
+            const int nPixelValue
+                = anCharLookup[pabyInLine[iPixel]];
             if( nPixelValue != -1 )
                 pabyImage[iLine * *pnXSize + iPixel] = (GByte) nPixelValue;
         }
diff --git a/gcore/gdal_mdreader.cpp b/gcore/gdal_mdreader.cpp
index 8f1ef56..afb853e 100644
--- a/gcore/gdal_mdreader.cpp
+++ b/gcore/gdal_mdreader.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdal_mdreader.cpp 29190 2015-05-13 21:40:30Z bishop $
+ * $Id: gdal_mdreader.cpp 31770 2015-11-25 23:01:18Z rouault $
  *
  * Project:  GDAL Core
  * Purpose:  Read metadata (mainly the remote sensing imagery) from files of 
@@ -48,7 +48,7 @@
 #include "mdreader/reader_eros.h"
 #include "mdreader/reader_kompsat.h"
 
-CPL_CVSID("$Id: gdal_mdreader.cpp 29190 2015-05-13 21:40:30Z bishop $");
+CPL_CVSID("$Id: gdal_mdreader.cpp 31770 2015-11-25 23:01:18Z rouault $");
 
 /**
  * The RPC parameters names
@@ -111,6 +111,10 @@ GDALMDReaderBase* GDALMDReaderManager::GetReader(const char *pszPath,
                                                  char **papszSiblingFiles,
                                                  GUInt32 nType)
 {
+    /* Do no attempt reading side-car files on /vsisubfile/ (#6241) */
+    if( strncmp(pszPath, "/vsisubfile/", strlen("/vsisubfile/")) == 0 )
+        return NULL;
+
     if(nType & MDR_DG)
     {
         INIT_READER(GDALMDReaderDigitalGlobe);
diff --git a/gcore/gdal_priv.h b/gcore/gdal_priv.h
index 0ceb9db..4a5e83d 100644
--- a/gcore/gdal_priv.h
+++ b/gcore/gdal_priv.h
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdal_priv.h 29284 2015-06-03 13:26:10Z rouault $
+ * $Id: gdal_priv.h 31109 2015-10-23 19:53:08Z rouault $
  *
  * Name:     gdal_priv.h
  * Project:  GDAL Core
@@ -352,7 +352,9 @@ class CPL_DLL GDALDataset : public GDALMajorObject
     
     int                 EnterReadWrite(GDALRWFlag eRWFlag);
     void                LeaveReadWrite();
-    
+
+    void                TemporarilyDropReadWriteLock();
+    void                ReacquireReadWriteLock();
     
   public:
     virtual     ~GDALDataset();
@@ -430,7 +432,7 @@ class CPL_DLL GDALDataset : public GDALMajorObject
     void ReportError(CPLErr eErrClass, int err_no, const char *fmt, ...)  CPL_PRINT_FUNC_FORMAT (4, 5);
 
 private:
-    CPLMutex        *m_hMutex;
+    void           *m_hPrivateData;
 
     OGRLayer*       BuildLayerFromSelectInfo(swq_select* psSelectInfo,
                                              OGRGeometry *poSpatialFilter,
diff --git a/gcore/gdal_version.h b/gcore/gdal_version.h
index c923265..24e2281 100644
--- a/gcore/gdal_version.h
+++ b/gcore/gdal_version.h
@@ -6,7 +6,7 @@
 #ifndef GDAL_VERSION_MAJOR
 #  define GDAL_VERSION_MAJOR    2
 #  define GDAL_VERSION_MINOR    0
-#  define GDAL_VERSION_REV      1
+#  define GDAL_VERSION_REV      2
 #  define GDAL_VERSION_BUILD    0
 #endif
 
@@ -22,8 +22,8 @@
 #endif
 
 #ifndef GDAL_RELEASE_DATE
-#  define GDAL_RELEASE_DATE     20150915
+#  define GDAL_RELEASE_DATE     20160122
 #endif
 #ifndef GDAL_RELEASE_NAME
-#  define GDAL_RELEASE_NAME     "2.0.1"
+#  define GDAL_RELEASE_NAME     "2.0.2"
 #endif
diff --git a/gcore/gdaldataset.cpp b/gcore/gdaldataset.cpp
index 744629e..d6ec1bc 100644
--- a/gcore/gdaldataset.cpp
+++ b/gcore/gdaldataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdaldataset.cpp 29330 2015-06-14 12:11:11Z rouault $
+ * $Id: gdaldataset.cpp 31109 2015-10-23 19:53:08Z rouault $
  *
  * Project:  GDAL Core
  * Purpose:  Base class for raster file formats.  
@@ -46,7 +46,7 @@
 
 #include <map>
 
-CPL_CVSID("$Id: gdaldataset.cpp 29330 2015-06-14 12:11:11Z rouault $");
+CPL_CVSID("$Id: gdaldataset.cpp 31109 2015-10-23 19:53:08Z rouault $");
 
 CPL_C_START
 GDALAsyncReader *
@@ -63,6 +63,12 @@ CPL_C_END
 
 typedef struct
 {
+    CPLMutex* hMutex;
+    int       nMutexTakenCount;
+} GDALDatasetPrivate;
+
+typedef struct
+{
     /* PID of the thread that mark the dataset as shared */
     /* This may not be the actual PID, but the responsiblePID */
     GIntBig      nPID;
@@ -190,7 +196,7 @@ GDALDataset::GDALDataset()
         CPLGetConfigOption( "GDAL_FORCE_CACHING", "NO") );
     
     m_poStyleTable = NULL;
-    m_hMutex = NULL;
+    m_hPrivateData = CPLCalloc(1, sizeof(GDALDatasetPrivate));
 }
 
 
@@ -298,8 +304,10 @@ GDALDataset::~GDALDataset()
         m_poStyleTable = NULL;
     }
 
-    if( m_hMutex != NULL )
-        CPLDestroyMutex( m_hMutex );
+    GDALDatasetPrivate* psPrivate = (GDALDatasetPrivate* )m_hPrivateData;
+    if( psPrivate->hMutex != NULL )
+        CPLDestroyMutex( psPrivate->hMutex );
+    CPLFree(psPrivate);
 
     CSLDestroy( papszOpenOptions );
 }
@@ -365,7 +373,8 @@ void GDALDataset::FlushCache()
     int nLayers = GetLayerCount();
     if( nLayers > 0 )
     {
-        CPLMutexHolderD( &m_hMutex );
+        GDALDatasetPrivate* psPrivate = (GDALDatasetPrivate* )m_hPrivateData;
+        CPLMutexHolderD( &(psPrivate->hMutex) );
         for( i = 0; i < nLayers ; i++ )
         {
             OGRLayer *poLayer = GetLayer(i);
@@ -3719,7 +3728,8 @@ In GDAL 1.X, this method used to be in the OGRDataSource class.
 int GDALDataset::GetSummaryRefCount() const
 
 {
-    CPLMutexHolderD( (CPLMutex**) &m_hMutex );
+    GDALDatasetPrivate* psPrivate = (GDALDatasetPrivate* )m_hPrivateData;
+    CPLMutexHolderD( &(psPrivate->hMutex) );
     int nSummaryCount = nRefCount;
     int iLayer;
     GDALDataset *poUseThis = (GDALDataset *) this;
@@ -4084,7 +4094,8 @@ OGRErr GDALDataset::DeleteLayer( int iLayer )
 OGRLayer *GDALDataset::GetLayerByName( const char *pszName )
 
 {
-    CPLMutexHolderD( &m_hMutex );
+    GDALDatasetPrivate* psPrivate = (GDALDatasetPrivate* )m_hPrivateData;
+    CPLMutexHolderD( &(psPrivate->hMutex) );
 
     if ( ! pszName )
         return NULL;
@@ -4151,7 +4162,8 @@ OGRErr GDALDataset::ProcessSQLCreateIndex( const char *pszSQLCommand )
     OGRLayer *poLayer = NULL;
 
     {
-        CPLMutexHolderD( &m_hMutex );
+        GDALDatasetPrivate* psPrivate = (GDALDatasetPrivate* )m_hPrivateData;
+        CPLMutexHolderD( &(psPrivate->hMutex) );
 
         for( i = 0; i < GetLayerCount(); i++ )
         {
@@ -4259,7 +4271,8 @@ OGRErr GDALDataset::ProcessSQLDropIndex( const char *pszSQLCommand )
     OGRLayer *poLayer=NULL;
 
     {
-        CPLMutexHolderD( &m_hMutex );
+        GDALDatasetPrivate* psPrivate = (GDALDatasetPrivate* )m_hPrivateData;
+        CPLMutexHolderD( &(psPrivate->hMutex) );
 
         for( i = 0; i < GetLayerCount(); i++ )
         {
@@ -5742,9 +5755,11 @@ OGRErr GDALDatasetRollbackTransaction(GDALDatasetH hDS)
 
 int GDALDataset::EnterReadWrite(GDALRWFlag eRWFlag)
 {
-    if( eAccess == GA_Update && (eRWFlag == GF_Write || m_hMutex != NULL) )
+    GDALDatasetPrivate* psPrivate = (GDALDatasetPrivate* )m_hPrivateData;
+    if( eAccess == GA_Update && (eRWFlag == GF_Write || psPrivate->hMutex != NULL) )
     {
-        CPLCreateOrAcquireMutex(&m_hMutex, 1000.0);
+        CPLCreateOrAcquireMutex(&psPrivate->hMutex, 1000.0);
+        psPrivate->nMutexTakenCount ++; /* not sure if we can have recursive calls, so ...*/
         return TRUE;
     }
     return FALSE;
@@ -5756,5 +5771,29 @@ int GDALDataset::EnterReadWrite(GDALRWFlag eRWFlag)
 
 void GDALDataset::LeaveReadWrite()
 {
-    CPLReleaseMutex(m_hMutex);
+    GDALDatasetPrivate* psPrivate = (GDALDatasetPrivate* )m_hPrivateData;
+    psPrivate->nMutexTakenCount --;
+    CPLReleaseMutex(psPrivate->hMutex);
+}
+
+/************************************************************************/
+/*                      TemporarilyDropReadWriteLock()                  */
+/************************************************************************/
+
+void GDALDataset::TemporarilyDropReadWriteLock()
+{
+    GDALDatasetPrivate* psPrivate = (GDALDatasetPrivate* )m_hPrivateData;
+    for(int i=0;i<psPrivate->nMutexTakenCount;i++)
+        CPLReleaseMutex(psPrivate->hMutex);
+}
+
+/************************************************************************/
+/*                       ReacquireReadWriteLock()                       */
+/************************************************************************/
+
+void GDALDataset::ReacquireReadWriteLock()
+{
+    GDALDatasetPrivate* psPrivate = (GDALDatasetPrivate* )m_hPrivateData;
+    for(int i=0;i<psPrivate->nMutexTakenCount;i++)
+        CPLAcquireMutex(psPrivate->hMutex, 1000.0);
 }
diff --git a/gcore/gdaldllmain.cpp b/gcore/gdaldllmain.cpp
index 19309d8..adc66e7 100644
--- a/gcore/gdaldllmain.cpp
+++ b/gcore/gdaldllmain.cpp
@@ -42,9 +42,7 @@ int GDALIsInGlobalDestructor(void)
     return bInGDALGlobalDestructor;
 }
 
-#ifndef _MSC_VER
 void CPLFinalizeTLS();
-#endif
 
 /************************************************************************/
 /*                           GDALDestroy()                              */
@@ -79,9 +77,12 @@ void GDALDestroy(void)
     OGRCleanupAll();
 #endif
     bInGDALGlobalDestructor = FALSE;
-#ifndef _MSC_VER
+
+    /* See https://trac.osgeo.org/gdal/ticket/6139 */
+    /* Needed in case no driver manager has been instanciated */
+    CPLFreeConfig();
     CPLFinalizeTLS();
-#endif
+    CPLCleanupMasterMutex();
 }
 
 /************************************************************************/
@@ -157,7 +158,7 @@ extern "C" int WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpRese
         GDALDestroy();
     }
 
-	return 1; // ignroed for all reasons but DLL_PROCESS_ATTACH
+    return 1; // ignroed for all reasons but DLL_PROCESS_ATTACH
 }
 
 #endif // _MSC_VER
diff --git a/gcore/gdalpamrasterband.cpp b/gcore/gdalpamrasterband.cpp
index f69be18..6976451 100644
--- a/gcore/gdalpamrasterband.cpp
+++ b/gcore/gdalpamrasterband.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdalpamrasterband.cpp 29038 2015-04-28 09:03:36Z rouault $
+ * $Id: gdalpamrasterband.cpp 32191 2015-12-16 16:14:07Z rouault $
  *
  * Project:  GDAL Core
  * Purpose:  Implementation of GDALPamRasterBand, a raster band base class
@@ -34,7 +34,7 @@
 #include "gdal_rat.h"
 #include "cpl_string.h"
 
-CPL_CVSID("$Id: gdalpamrasterband.cpp 29038 2015-04-28 09:03:36Z rouault $");
+CPL_CVSID("$Id: gdalpamrasterband.cpp 32191 2015-12-16 16:14:07Z rouault $");
 
 /************************************************************************/
 /*                         GDALPamRasterBand()                          */
@@ -1083,7 +1083,8 @@ PamHistogramToXMLTree( double dfMin, double dfMax,
     if( nBuckets > (INT_MAX - 10) / 12 )
         return NULL;
 
-    pszHistCounts = (char *) VSIMalloc(12 * nBuckets + 10);
+    const size_t nLen = 22 * static_cast<size_t>(nBuckets) + 10;
+    pszHistCounts = (char *) VSIMalloc(nLen);
     if( pszHistCounts == NULL )
         return NULL;
 
diff --git a/gcore/gdalproxypool.cpp b/gcore/gdalproxypool.cpp
index 9ffda13..0a591dd 100644
--- a/gcore/gdalproxypool.cpp
+++ b/gcore/gdalproxypool.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdalproxypool.cpp 29450 2015-07-02 08:44:48Z rouault $
+ * $Id: gdalproxypool.cpp 31754 2015-11-25 11:06:14Z rouault $
  *
  * Project:  GDAL Core
  * Purpose:  A dataset and raster band classes that differ the opening of the
@@ -31,7 +31,7 @@
 #include "gdal_proxy.h"
 #include "cpl_multiproc.h"
 
-CPL_CVSID("$Id: gdalproxypool.cpp 29450 2015-07-02 08:44:48Z rouault $");
+CPL_CVSID("$Id: gdalproxypool.cpp 31754 2015-11-25 11:06:14Z rouault $");
 
 /* We *must* share the same mutex as the gdaldataset.cpp file, as we are */
 /* doing GDALOpen() calls that can indirectly call GDALOpenShared() on */
@@ -490,6 +490,7 @@ void free_func_get_metadata(void* _elt)
     GetMetadataElt* elt = (GetMetadataElt*) _elt;
     CPLFree(elt->pszDomain);
     CSLDestroy(elt->papszMetadata);
+    CPLFree(elt);
 }
 
 
@@ -523,6 +524,7 @@ void free_func_get_metadata_item(void* _elt)
     CPLFree(elt->pszName);
     CPLFree(elt->pszDomain);
     CPLFree(elt->pszMetadataItem);
+    CPLFree(elt);
 }
 
 CPL_C_END
diff --git a/gcore/gdalrasterband.cpp b/gcore/gdalrasterband.cpp
index 2305a49..4fe0205 100644
--- a/gcore/gdalrasterband.cpp
+++ b/gcore/gdalrasterband.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdalrasterband.cpp 29284 2015-06-03 13:26:10Z rouault $
+ * $Id: gdalrasterband.cpp 31109 2015-10-23 19:53:08Z rouault $
  *
  * Project:  GDAL Core
  * Purpose:  Base class for format specific band class implementation.  This
@@ -37,7 +37,7 @@
 #define TO_SUBBLOCK(x) ((x) >> 6)
 #define WITHIN_SUBBLOCK(x) ((x) & 0x3f)
 
-CPL_CVSID("$Id: gdalrasterband.cpp 29284 2015-06-03 13:26:10Z rouault $");
+CPL_CVSID("$Id: gdalrasterband.cpp 31109 2015-10-23 19:53:08Z rouault $");
 
 /************************************************************************/
 /*                           GDALRasterBand()                           */
@@ -1362,8 +1362,21 @@ GDALRasterBlock * GDALRasterBand::GetLockedBlockRef( int nXBlockOff,
 
         poBlock->AddLock();
 
+        /* We need to temporarily drop the read-write lock in the following */
+        /*scenario. Imagine 2 threads T1 and T2 that respectively write dataset */
+        /* D1 and D2. T1 will take the mutex on D1 and T2 on D2. Now when the */
+        /* block cache fills, T1 might need to flush dirty blocks of D2 in the */
+        /* below Internalize(), which will cause GDALRasterBlock::Write() to be */
+        /* called and attempt at taking the lock on T2 (already taken). Similarly */
+        /* for T2 with D1, hence a deadlock situation (#6163) */
+        /* But this may open the door to other problems... */
+        if( poDS )
+            poDS->TemporarilyDropReadWriteLock();
         /* allocate data space */
-        if( poBlock->Internalize() != CE_None )
+        CPLErr eErr = poBlock->Internalize();
+        if( poDS )
+            poDS->ReacquireReadWriteLock();
+        if( eErr != CE_None )
         {
             poBlock->DropLock();
             delete poBlock;
diff --git a/gcore/gdalrasterblock.cpp b/gcore/gdalrasterblock.cpp
index bc89766..33f1d86 100644
--- a/gcore/gdalrasterblock.cpp
+++ b/gcore/gdalrasterblock.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdalrasterblock.cpp 29334 2015-06-14 17:30:54Z rouault $
+ * $Id: gdalrasterblock.cpp 31657 2015-11-20 13:14:23Z rouault $
  *
  * Project:  GDAL Core
  * Purpose:  Implementation of GDALRasterBlock class and related global 
@@ -32,7 +32,7 @@
 #include "gdal_priv.h"
 #include "cpl_multiproc.h"
 
-CPL_CVSID("$Id: gdalrasterblock.cpp 29334 2015-06-14 17:30:54Z rouault $");
+CPL_CVSID("$Id: gdalrasterblock.cpp 31657 2015-11-20 13:14:23Z rouault $");
 
 static int bCacheMaxInitialized = FALSE;
 static GIntBig nCacheMax = 40 * 1024*1024;
@@ -737,7 +737,7 @@ CPLErr GDALRasterBlock::Internalize()
                     }
                     if( nBlocksToFree == 64 )
                     {
-                        CPLDebug("GDAL", "More than 64 blocks are flagged to be flushed. Not trying more");
+                        bLoopAgain = ( nCacheUsed > nCurCacheMax );
                         break;
                     }
 
@@ -774,7 +774,7 @@ CPLErr GDALRasterBlock::Internalize()
             /* Try to recycle the data of an existing block */
             void* pDataBlock = poBlock->pData;
             if( pNewData == NULL && pDataBlock != NULL &&
-                poBlock->GetBlockSize() >= nSizeInBytes )
+                poBlock->GetBlockSize() == nSizeInBytes )
             {
                 pNewData = pDataBlock;
                 poBlock->pData = NULL;
diff --git a/m4/ax_lib_libkml.m4 b/m4/ax_lib_libkml.m4
index e431e35..0c92e75 100644
--- a/m4/ax_lib_libkml.m4
+++ b/m4/ax_lib_libkml.m4
@@ -1,22 +1,30 @@
-dnl $Id: ax_lib_libkml.m4 23867 2012-02-02 00:00:19Z winkey $
+dnl $Id: ax_lib_libkml.m4 30555 2015-09-19 11:47:36Z rouault $
 dnl
 dnl @synopsis AX_LIB_LIBKML([MINIMUM-VERSION])
 dnl
 dnl This macro provides tests of availability of Google libkml library
 dnl of particular version or newer.
 dnl
-dnl libkml - http://code.google.com/p/libkml/
+dnl libkml - https://github.com/google/libkml
 dnl
-dnl This macros checks for Google libkml headers and libraries 
+dnl A fork of libkml is also available:
+dnl
+dnl https://github.com/libkml/libkml
+dnl
+dnl This macros checks for Google libkml headers and libraries
 dnl and defines compilation flags.
-dnl 
+dnl
+dnl The libkml fork supports pkg-config, which is tried first.
+dnl If a suitable libkml version is not found with pkg-config, the manual
+dnl checks for the libkml library & include paths are performed.
+dnl
 dnl Macro supports following options and their values:
 dnl 1) Single-option usage:
 dnl --with-libkml - yes, no or path to Google libkml installation prefix
 dnl 2) Three-options usage (all options are required):
 dnl --with-libkml=yes
 dnl --with-libkml-inc - path to base directory with  headers
-dnl --with-libkml-lib - linker flags for 
+dnl --with-libkml-lib - linker flags for
 dnl
 dnl This macro calls:
 dnl
@@ -31,7 +39,7 @@ dnl
 dnl @category InstalledPackages
 dnl @category Cxx
 dnl @author Mateusz Loskot <mateusz at loskot.net>
-dnl @version $Date: 2012-02-01 16:00:19 -0800 (Wed, 01 Feb 2012) $
+dnl @version $Date: 2015-09-19 04:47:36 -0700 (Sat, 19 Sep 2015) $
 dnl @license AllPermissive
 dnl          Copying and distribution of this file, with or without modification,
 dnl          are permitted in any medium without royalty provided the copyright notice and
@@ -45,7 +53,7 @@ AC_DEFUN([AX_LIB_LIBKML],
         ),
         [
         if test "$withval" = "yes"; then
-            if test -d /usr/local/include/kml ; then 
+            if test -d /usr/local/include/kml ; then
                 libkml_prefix=/usr/local
             elif test -d /usr/include/kml ; then
                 libkml_prefix=/usr
@@ -63,12 +71,12 @@ AC_DEFUN([AX_LIB_LIBKML],
         ],
         [
         dnl Default behavior is implicit yes
-        if test -d /usr/local/include/kml ; then 
+        if test -d /usr/local/include/kml ; then
             libkml_prefix=/usr/local
         elif test -d /usr/include/kml ; then
             libkml_prefix=/usr
         else
-            libkml_prefix="" 
+            libkml_prefix=""
         fi
         ]
     )
@@ -88,181 +96,209 @@ AC_DEFUN([AX_LIB_LIBKML],
         [libkml_lib_flags=""]
     )
 
-    LIBKML_CFLAGS=""
-    LIBKML_LDFLAGS=""
-    LIBKML_VERSION=""
-
-    dnl
-    dnl Collect include/lib paths and flags
-    dnl 
-    run_libkml_test="no"
-
-    if test -n "$libkml_prefix"; then
-        libkml_include_dir="$libkml_prefix/include"
-        libkml_include_dir2="$libkml_prefix/include/kml"
-        libkml_include_dir3="$libkml_prefix/include/kml/third_party/boost_1_34_1"
-        if test "$libkml_prefix" = "/usr"; then
-            libkml_lib_flags="-lkmldom -lkmlbase -lkmlengine -lkmlconvenience -lminizip -luriparser"
-        else
-            libkml_lib_flags="-L$libkml_prefix/lib -lkmldom -lkmlbase -lkmlengine -lkmlconvenience -lminizip -luriparser"
-        fi
-        run_libkml_test="yes"
-    elif test "$libkml_requested" = "yes"; then
-        if test -n "$libkml_include_dir" -a -n "$libkml_lib_flags"; then
-            libkml_include_dir2="$libkml_include_dir/kml"
-            libkml_include_dir3="$libkml_include_dir/kml/third_party/boost_1_34_1"
-            run_libkml_test="yes"
-        fi
-    else
-        run_libkml_test="no"
-    fi
-
     dnl
-    dnl Check libkml headers/libraries
+    dnl Try pkg-config first
     dnl
-    if test "$run_libkml_test" = "yes"; then
+    PKG_PROG_PKG_CONFIG([0.25]) # check and set $PKG_CONFIG
 
-        saved_CPPFLAGS="$CPPFLAGS"
-        CPPFLAGS="$CPPFLAGS -I$libkml_include_dir -I$libkml_include_dir2 -I$libkml_include_dir3"
+    PKG_CHECK_MODULES([LIBKML], [libkml >= $1],
+        [LIBKML_VERSION=`$PKG_CONFIG --modversion libkml`],
+        [LIBKML_VERSION=;])
 
-        saved_LIBS="$LIBS"
-        LIBS="$LIBS $libkml_lib_flags"
+    if test -n "$LIBKML_VERSION" -a -n "$libkml_prefix"; then
+        HAVE_LIBKML="yes"
+
+	LIBKML_LDFLAGS="$LIBKML_LIBS"
+
+	AC_MSG_CHECKING([for LIBKML CFLAGS])
+        AC_MSG_RESULT([$LIBKML_CFLAGS])
+
+	AC_MSG_CHECKING([for LIBKML LDFLAGS])
+	AC_MSG_RESULT([$LIBKML_LDFLAGS])
+
+	AC_MSG_CHECKING([for LIBKML VERSION])
+	AC_MSG_RESULT([$LIBKML_VERSION])
+
+        AC_SUBST([LIBKML_CFLAGS])
+        AC_SUBST([LIBKML_LDLAGS])
+        AC_SUBST([LIBKML_VERSION])
+    else
+        LIBKML_CFLAGS=""
+        LIBKML_LDFLAGS=""
+        LIBKML_VERSION=""
 
         dnl
-        dnl Check headers
+        dnl Collect include/lib paths and flags
         dnl
-        AC_MSG_CHECKING([for Google libkml headers in $libkml_include_dir, $libkml_include_dir2, and $libkml_include_dir3])
+        run_libkml_test="no"
+
+        if test -n "$libkml_prefix"; then
+            libkml_include_dir="$libkml_prefix/include"
+            libkml_include_dir2="$libkml_prefix/include/kml"
+            libkml_include_dir3="$libkml_prefix/include/kml/third_party/boost_1_34_1"
+            if test "$libkml_prefix" = "/usr"; then
+                libkml_lib_flags="-lkmldom -lkmlbase -lkmlengine -lkmlconvenience -lminizip -luriparser"
+            else
+                libkml_lib_flags="-L$libkml_prefix/lib -lkmldom -lkmlbase -lkmlengine -lkmlconvenience -lminizip -luriparser"
+            fi
+            run_libkml_test="yes"
+        elif test "$libkml_requested" = "yes"; then
+            if test -n "$libkml_include_dir" -a -n "$libkml_lib_flags"; then
+                libkml_include_dir2="$libkml_include_dir/kml"
+                libkml_include_dir3="$libkml_include_dir/kml/third_party/boost_1_34_1"
+                run_libkml_test="yes"
+            fi
+        else
+            run_libkml_test="no"
+        fi
 
-        AC_LANG_PUSH([C++])
-        AC_COMPILE_IFELSE([
-            AC_LANG_PROGRAM(
-                [[
-@%:@include <kml/dom.h>
-                ]],
-                [[]]
-            )],
-            [
-            LIBKML_CFLAGS="-I$libkml_include_dir -I$libkml_include_dir2 -I$libkml_include_dir3"
-            libkml_header_found="yes"
-            AC_MSG_RESULT([found])
-            ],
-            [
-            libkml_header_found="no"
-            AC_MSG_RESULT([not found])
-            ]
-        )
-        AC_LANG_POP([C++])
-        
         dnl
-        dnl Check libraries
+        dnl Check libkml headers/libraries
         dnl
-        if test "$libkml_header_found" = "yes"; then
+        if test "$run_libkml_test" = "yes"; then
+
+            saved_CPPFLAGS="$CPPFLAGS"
+            CPPFLAGS="$CPPFLAGS -I$libkml_include_dir -I$libkml_include_dir2 -I$libkml_include_dir3"
 
-            AC_MSG_CHECKING([for Google libkml libraries])
+            saved_LIBS="$LIBS"
+            LIBS="$LIBS $libkml_lib_flags"
+
+            dnl
+            dnl Check headers
+            dnl
+            AC_MSG_CHECKING([for Google libkml headers in $libkml_include_dir, $libkml_include_dir2, and $libkml_include_dir3])
 
             AC_LANG_PUSH([C++])
-            AC_LINK_IFELSE([
+            AC_COMPILE_IFELSE([
                 AC_LANG_PROGRAM(
                     [[
 @%:@include <kml/dom.h>
                     ]],
-                    [[
-kmldom::KmlFactory* factory = kmldom::KmlFactory::GetFactory();
-                    ]]
+                    [[]]
                 )],
                 [
-                LIBKML_LDFLAGS="$libkml_lib_flags"
-                libkml_lib_found="yes"
+                LIBKML_CFLAGS="-I$libkml_include_dir -I$libkml_include_dir2 -I$libkml_include_dir3"
+                libkml_header_found="yes"
                 AC_MSG_RESULT([found])
                 ],
                 [
-                libkml_lib_found="no"
+                libkml_header_found="no"
                 AC_MSG_RESULT([not found])
                 ]
             )
             AC_LANG_POP([C++])
+
+            dnl
+            dnl Check libraries
+            dnl
+            if test "$libkml_header_found" = "yes"; then
+
+                AC_MSG_CHECKING([for Google libkml libraries])
+
+                AC_LANG_PUSH([C++])
+                AC_LINK_IFELSE([
+                    AC_LANG_PROGRAM(
+                        [[
+@%:@include <kml/dom.h>
+                        ]],
+                        [[
+kmldom::KmlFactory* factory = kmldom::KmlFactory::GetFactory();
+                        ]]
+                    )],
+                    [
+                    LIBKML_LDFLAGS="$libkml_lib_flags"
+                    libkml_lib_found="yes"
+                    AC_MSG_RESULT([found])
+                    ],
+                    [
+                    libkml_lib_found="no"
+                    AC_MSG_RESULT([not found])
+                    ]
+                )
+                AC_LANG_POP([C++])
+            fi
+
+            CPPFLAGS="$saved_CPPFLAGS"
+            LIBS="$saved_LIBS"
         fi
 
-        CPPFLAGS="$saved_CPPFLAGS"
-        LIBS="$saved_LIBS"
-    fi
+        AC_MSG_CHECKING([for Google libkml])
+
+        if test "$run_libkml_test" = "yes"; then
+            if test "$libkml_header_found" = "yes" -a "$libkml_lib_found" = "yes"; then
 
-    AC_MSG_CHECKING([for Google libkml])
+                AC_SUBST([LIBKML_CFLAGS])
+                AC_SUBST([LIBKML_LDFLAGS])
 
-    if test "$run_libkml_test" = "yes"; then
-        if test "$libkml_header_found" = "yes" -a "$libkml_lib_found" = "yes"; then
+                HAVE_LIBKML="yes"
+            else
+                HAVE_LIBKML="no"
+            fi
 
-            AC_SUBST([LIBKML_CFLAGS])
-            AC_SUBST([LIBKML_LDFLAGS])
+            AC_MSG_RESULT([$HAVE_LIBKML])
 
-            HAVE_LIBKML="yes"
-        else 
-            HAVE_LIBKML="no"
-        fi
+            dnl
+            dnl Check  version
+            dnl
+            if test "$HAVE_LIBKML" = "yes"; then
 
-        AC_MSG_RESULT([$HAVE_LIBKML])
+                libkml_version_req=ifelse([$1], [], [], [$1])
 
-        dnl
-        dnl Check  version
-        dnl
-        if test "$HAVE_LIBKML" = "yes"; then
+                if test  -n "$libkml_version_req"; then
 
-            libkml_version_req=ifelse([$1], [], [], [$1])
-            
-            if test  -n "$libkml_version_req"; then
+                    AC_MSG_CHECKING([if Google libkml version is >= $libkml_version_req])
 
-                AC_MSG_CHECKING([if Google libkml version is >= $libkml_version_req])
+                    if test -f "$libkml_include_dir2/base/version.h"; then
 
-                if test -f "$libkml_include_dir2/base/version.h"; then
+                        libkml_major=$(sed -n '/^#define LIBKML_MAJOR_VERSION.*$/{s/\([^0-9]*\)\([0-9]*\).*/\2/;P;}' \
+                            $libkml_include_dir2/base/version.h)
+                        libkml_minor=$(sed -n '/^#define LIBKML_MINOR_VERSION.*$/{s/\([^0-9]*\)\([0-9]*\).*/\2/;P;}' \
+                            $libkml_include_dir2/base/version.h)
+                        libkml_revision=$(sed -n '/^#define LIBKML_MICRO_VERSION.*$/{s/\([^0-9]*\)\([0-9]*\).*/\2/;P;}' \
+                            $libkml_include_dir2/base/version.h)
 
-                    libkml_major=$(sed -n '/^#define LIBKML_MAJOR_VERSION.*$/{s/\([^0-9]*\)\([0-9]*\).*/\2/;P;}' \
-		    	$libkml_include_dir2/base/version.h)
-                    libkml_minor=$(sed -n '/^#define LIBKML_MINOR_VERSION.*$/{s/\([^0-9]*\)\([0-9]*\).*/\2/;P;}' \
-		    	$libkml_include_dir2/base/version.h)
-                    libkml_revision=$(sed -n '/^#define LIBKML_MICRO_VERSION.*$/{s/\([^0-9]*\)\([0-9]*\).*/\2/;P;}' \
-		    	$libkml_include_dir2/base/version.h)
+                        LIBKML_VERSION="$libkml_major.$libkml_minor.$libkml_revision"
+                        AC_SUBST([LIBKML_VERSION])
 
-                    LIBKML_VERSION="$libkml_major.$libkml_minor.$libkml_revision"
-                    AC_SUBST([LIBKML_VERSION])
+                        dnl Decompose required version string and calculate numerical representation
+                        libkml_version_req_major=`expr $libkml_version_req : '\([[0-9]]*\)'`
+                        libkml_version_req_minor=`expr $libkml_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
+                        libkml_version_req_revision=`expr $libkml_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
+                        if test "x$libkml_version_req_revision" = "x"; then
+                            libkml_version_req_revision="0"
+                        fi
 
-                    dnl Decompose required version string and calculate numerical representation
-                    libkml_version_req_major=`expr $libkml_version_req : '\([[0-9]]*\)'`
-                    libkml_version_req_minor=`expr $libkml_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
-                    libkml_version_req_revision=`expr $libkml_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
-                    if test "x$libkml_version_req_revision" = "x"; then
-                        libkml_version_req_revision="0"
-                    fi
-                    
-                    libkml_version_req_number=`expr $libkml_version_req_major \* 10000 \
-                                               \+ $libkml_version_req_minor \* 100 \
-                                               \+ $libkml_version_req_revision`
-
-                    dnl Calculate numerical representation of detected version
-                    libkml_version_number=`expr $libkml_major \* 10000 \
-                                          \+ $libkml_minor \* 100 \
-                                           \+ $libkml_revision`
-
-                    libkml_version_check=`expr $libkml_version_number \>\= $libkml_version_req_number`
-                    if test "$libkml_version_check" = "1"; then
-                        AC_MSG_RESULT([yes])
+                        libkml_version_req_number=`expr $libkml_version_req_major \* 10000 \
+                                                   \+ $libkml_version_req_minor \* 100 \
+                                                   \+ $libkml_version_req_revision`
+
+                        dnl Calculate numerical representation of detected version
+                        libkml_version_number=`expr $libkml_major \* 10000 \
+                                              \+ $libkml_minor \* 100 \
+                                               \+ $libkml_revision`
+
+                        libkml_version_check=`expr $libkml_version_number \>\= $libkml_version_req_number`
+                        if test "$libkml_version_check" = "1"; then
+                            AC_MSG_RESULT([yes])
+                        else
+                            AC_MSG_RESULT([no])
+                            AC_MSG_WARN([Found Google libkml ${LIBKML_VERSION}, which is older than required (${libkml_version_req}). KML support disabled.])
+                            HAVE_LIBKML="no"
+                        fi
                     else
                         AC_MSG_RESULT([no])
-                        AC_MSG_WARN([Found Google libkml ${LIBKML_VERSION}, which is older than required (${libkml_version_req}). KML support disabled.])
-			HAVE_LIBKML="no"
+                        AC_MSG_WARN([Missing header $libkml_include_dir2/base/bersion.hpp. Unable to determine Google libkml version.])
                     fi
-                else
-                    AC_MSG_RESULT([no])
-                    AC_MSG_WARN([Missing header $libkml_include_dir2/base/bersion.hpp. Unable to determine Google libkml version.])
                 fi
             fi
-        fi
 
-    else
-        HAVE_LIBKML="no"
-        AC_MSG_RESULT([$HAVE_LIBKML])
+        else
+            HAVE_LIBKML="no"
+            AC_MSG_RESULT([$HAVE_LIBKML])
 
-        if test "$libkml_requested" = "yes"; then
-            AC_MSG_WARN([Google libkml support requested but headers or library not found. Specify valid prefix of libkml using --with-libkml=@<:@DIR@:>@ or provide include directory and linker flags using --with-libkml-inc and --with-libkml-lib])
+            if test "$libkml_requested" = "yes"; then
+                AC_MSG_WARN([Google libkml support requested but headers or library not found. Specify valid prefix of libkml using --with-libkml=@<:@DIR@:>@ or provide include directory and linker flags using --with-libkml-inc and --with-libkml-lib])
+            fi
         fi
     fi
 ])
diff --git a/m4/pkg.m4 b/m4/pkg.m4
new file mode 100644
index 0000000..0048a3f
--- /dev/null
+++ b/m4/pkg.m4
@@ -0,0 +1,157 @@
+# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
+# 
+# Copyright © 2004 Scott James Remnant <scott at netsplit.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
+# ----------------------------------
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
+m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+fi
+if test -n "$PKG_CONFIG"; then
+	_pkg_min_version=m4_default([$1], [0.9.0])
+	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
+	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+		AC_MSG_RESULT([yes])
+	else
+		AC_MSG_RESULT([no])
+		PKG_CONFIG=""
+	fi
+		
+fi[]dnl
+])# PKG_PROG_PKG_CONFIG
+
+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+# Check to see whether a particular set of modules exists.  Similar
+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
+#
+#
+# Similar to PKG_CHECK_MODULES, make sure that the first instance of
+# this or PKG_CHECK_MODULES is called, or make sure to call
+# PKG_CHECK_EXISTS manually
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_EXISTS],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+if test -n "$PKG_CONFIG" && \
+    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
+  m4_ifval([$2], [$2], [:])
+m4_ifvaln([$3], [else
+  $3])dnl
+fi])
+
+
+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+# ---------------------------------------------
+m4_define([_PKG_CONFIG],
+[if test -n "$PKG_CONFIG"; then
+    if test -n "$$1"; then
+        pkg_cv_[]$1="$$1"
+    else
+        PKG_CHECK_EXISTS([$3],
+                         [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
+			 [pkg_failed=yes])
+    fi
+else
+	pkg_failed=untried
+fi[]dnl
+])# _PKG_CONFIG
+
+# _PKG_SHORT_ERRORS_SUPPORTED
+# -----------------------------
+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi[]dnl
+])# _PKG_SHORT_ERRORS_SUPPORTED
+
+
+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+# [ACTION-IF-NOT-FOUND])
+#
+#
+# Note that if there is a possibility the first call to
+# PKG_CHECK_MODULES might not happen, you should be sure to include an
+# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
+#
+#
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_MODULES],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
+
+pkg_failed=no
+AC_MSG_CHECKING([for $1])
+
+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+
+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
+and $1[]_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.])
+
+if test $pkg_failed = yes; then
+        _PKG_SHORT_ERRORS_SUPPORTED
+        if test $_pkg_short_errors_supported = yes; then
+	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
+        else 
+	        $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+
+	ifelse([$4], , [AC_MSG_ERROR(dnl
+[Package requirements ($2) were not met:
+
+$$1_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+_PKG_TEXT
+])],
+		[AC_MSG_RESULT([no])
+                $4])
+elif test $pkg_failed = untried; then
+	ifelse([$4], , [AC_MSG_FAILURE(dnl
+[The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+_PKG_TEXT
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
+		[$4])
+else
+	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+        AC_MSG_RESULT([yes])
+	ifelse([$3], , :, [$3])
+fi[]dnl
+])# PKG_CHECK_MODULES
diff --git a/man/man1/_home_rouault_dist_wrk_gdal_apps_.1 b/man/man1/_home_rouault_dist_wrk_gdal_apps_.1
new file mode 100644
index 0000000..574d7dc
--- /dev/null
+++ b/man/man1/_home_rouault_dist_wrk_gdal_apps_.1
@@ -0,0 +1,93 @@
+.TH "apps Directory Reference" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+apps Directory Reference \- 
+.SH SYNOPSIS
+.br
+.PP
+.SS "Files"
+
+.in +1c
+.ti -1c
+.RI "file \fBcommonutils\&.cpp\fP"
+.br
+.ti -1c
+.RI "file \fBdumpoverviews\&.cpp\fP"
+.br
+.ti -1c
+.RI "file \fBgdal_contour\&.cpp\fP"
+.br
+.ti -1c
+.RI "file \fBgdal_grid\&.cpp\fP"
+.br
+.ti -1c
+.RI "file \fBgdal_rasterize\&.cpp\fP"
+.br
+.ti -1c
+.RI "file \fBgdal_translate\&.cpp\fP"
+.br
+.ti -1c
+.RI "file \fBgdaladdo\&.cpp\fP"
+.br
+.ti -1c
+.RI "file \fBgdalasyncread\&.cpp\fP"
+.br
+.ti -1c
+.RI "file \fBgdalbuildvrt\&.cpp\fP"
+.br
+.ti -1c
+.RI "file \fBgdaldem\&.cpp\fP"
+.br
+.ti -1c
+.RI "file \fBgdalenhance\&.cpp\fP"
+.br
+.ti -1c
+.RI "file \fBgdallocationinfo\&.cpp\fP"
+.br
+.ti -1c
+.RI "file \fBgdalmanage\&.cpp\fP"
+.br
+.ti -1c
+.RI "file \fBgdalsrsinfo\&.cpp\fP"
+.br
+.ti -1c
+.RI "file \fBgdaltorture\&.cpp\fP"
+.br
+.ti -1c
+.RI "file \fBgdaltransform\&.cpp\fP"
+.br
+.ti -1c
+.RI "file \fBgdalwarp\&.cpp\fP"
+.br
+.ti -1c
+.RI "file \fBmultireadtest\&.cpp\fP"
+.br
+.ti -1c
+.RI "file \fBnearblack\&.cpp\fP"
+.br
+.ti -1c
+.RI "file \fBogr2ogr\&.cpp\fP"
+.br
+.ti -1c
+.RI "file \fBogrdissolve\&.cpp\fP"
+.br
+.ti -1c
+.RI "file \fBogrinfo\&.cpp\fP"
+.br
+.ti -1c
+.RI "file \fBogrlineref\&.cpp\fP"
+.br
+.ti -1c
+.RI "file \fBogrtindex\&.cpp\fP"
+.br
+.ti -1c
+.RI "file \fBtest_ogrsf\&.cpp\fP"
+.br
+.ti -1c
+.RI "file \fBtestepsg\&.cpp\fP"
+.br
+.ti -1c
+.RI "file \fBtestreprojmulti\&.cpp\fP"
+.br
+.in -1c
diff --git a/man/man1/gdal-config.1 b/man/man1/gdal-config.1
index 7ce23f0..1299619 100644
--- a/man/man1/gdal-config.1
+++ b/man/man1/gdal-config.1
@@ -1,4 +1,4 @@
-.TH "gdal-config" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "gdal-config" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -8,7 +8,6 @@ determines various information about a GDAL installation
 .PP
 .PP
 .nf
-
 gdal-config [OPTIONS]
 Options:
         [--prefix[=DIR]]
diff --git a/man/man1/gdal2tiles.1 b/man/man1/gdal2tiles.1
index ad30d7a..e7c50f9 100644
--- a/man/man1/gdal2tiles.1
+++ b/man/man1/gdal2tiles.1
@@ -1,4 +1,4 @@
-.TH "gdal2tiles" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "gdal2tiles" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -8,7 +8,6 @@ generates directory with TMS tiles, KMLs and simple web viewers
 .PP
 .PP
 .nf
-
 gdal2tiles.py [-p profile] [-r resampling] [-s srs] [-z zoom]
               [-e] [-a nodata] [-v] [-h] [-k] [-n] [-u url]
               [-w webviewer] [-t title] [-c copyright]
@@ -73,4 +72,4 @@ Bing Maps API key from https://www.bingmapsportal.com/
 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\&. 
+Klokan Petr Pridal klokan at klokan.cz as a Google SoC 2007 Project\&. 
diff --git a/man/man1/gdal_calc.1 b/man/man1/gdal_calc.1
index 45d61c0..d79ac27 100644
--- a/man/man1/gdal_calc.1
+++ b/man/man1/gdal_calc.1
@@ -1,4 +1,4 @@
-.TH "gdal_calc" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "gdal_calc" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -8,7 +8,6 @@ Command line raster calculator with numpy syntax
 .PP
 .PP
 .nf
-
 gdal_calc.py [-A <filename>] [--A_band] [-B...-Z filename] [other_options]
 
 Options:
@@ -43,7 +42,6 @@ Command line raster calculator with numpy syntax\&. Use any basic arithmetic sup
 add two files together 
 .PP
 .nf
-
 gdal_calc.py -A input1.tif -B input2.tif --outfile=result.tif --calc="A+B"
 
 .fi
@@ -52,7 +50,6 @@ gdal_calc.py -A input1.tif -B input2.tif --outfile=result.tif --calc="A+B"
 average of two layers 
 .PP
 .nf
-
 gdal_calc.py -A input.tif -B input2.tif --outfile=result.tif --calc="(A+B)/2"
 
 .fi
@@ -61,7 +58,6 @@ gdal_calc.py -A input.tif -B input2.tif --outfile=result.tif --calc="(A+B)/2"
 set values of zero and below to null 
 .PP
 .nf
-
 gdal_calc.py -A input.tif --outfile=result.tif --calc="A*(A>0)" --NoDataValue=0
 
 .fi
diff --git a/man/man1/gdal_contour.1 b/man/man1/gdal_contour.1
index 89b5301..2020139 100644
--- a/man/man1/gdal_contour.1
+++ b/man/man1/gdal_contour.1
@@ -1,4 +1,4 @@
-.TH "gdal_contour" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "gdal_contour" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -8,7 +8,6 @@ builds vector contour lines from a raster elevation model
 .PP
 .PP
 .nf
-
 Usage: gdal_contour [-b <band>] [-a <attribute_name>] [-3d] [-inodata]
                     [-snodata n] [-i <interval>]
                     [-f <formatname>] [[-dsco NAME=VALUE] ...] [[-lco NAME=VALUE] ...]
@@ -62,10 +61,9 @@ This would create 10meter contours from the DEM data in dem\&.tif and produce a
 .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> 
+Frank Warmerdam warmerdam at pobox.com, Silke Reimer silke at intevation.de 
diff --git a/man/man1/gdal_edit.1 b/man/man1/gdal_edit.1
index b12d3a9..ad50d4c 100644
--- a/man/man1/gdal_edit.1
+++ b/man/man1/gdal_edit.1
@@ -1,4 +1,4 @@
-.TH "gdal_edit" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "gdal_edit" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -8,7 +8,6 @@ Edit in place various information of an existing GDAL dataset
 .PP
 .PP
 .nf
-
 gdal_edit [--help-general] [-ro] [-a_srs srs_def] [-a_ullr ulx uly lrx lry]
           [-tr xres yres] [-unsetgt] [-a_nodata value]
           [-unsetstats] [-stats] [-approx_stats]
@@ -73,7 +72,6 @@ Passes a metadata key and value to set on the output dataset if possible\&. This
 .PP
 .PP
 .nf
-
 gdal_edit -mo DATUM=WGS84 -mo PROJ=GEODETIC -a_ullr 7 47 8 46 test.ecw
 .fi
 .PP
diff --git a/man/man1/gdal_fillnodata.1 b/man/man1/gdal_fillnodata.1
index 4b67968..2a9fea8 100644
--- a/man/man1/gdal_fillnodata.1
+++ b/man/man1/gdal_fillnodata.1
@@ -1,4 +1,4 @@
-.TH "gdal_fillnodata" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "gdal_fillnodata" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -8,7 +8,6 @@ fill raster regions by interpolation from edges
 .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]
@@ -53,4 +52,4 @@ Select the output format\&. The default is GeoTIFF (GTiff)\&. Use the short form
 .PP
 .SH "AUTHORS"
 .PP
-Frank Warmerdam <warmerdam at pobox.com> 
+Frank Warmerdam warmerdam at pobox.com 
diff --git a/man/man1/gdal_grid.1 b/man/man1/gdal_grid.1
index ac14d60..b88f3dd 100644
--- a/man/man1/gdal_grid.1
+++ b/man/man1/gdal_grid.1
@@ -1,4 +1,4 @@
-.TH "gdal_grid" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "gdal_grid" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -8,19 +8,18 @@ creates regular grid from the scattered data
 .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] [-z_increase increase_value] [-z_multiply multiply_value]
-	  [-a_srs srs_def] [-spat xmin ymin xmax ymax]
+          [-of format] [-co "NAME=VALUE"]
+          [-zfield field_name] [-z_increase increase_value] [-z_multiply multiply_value]
+          [-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>
+          [-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"
@@ -193,7 +192,6 @@ Here is a small example\&. Let we have a CSV file called \fIdem\&.csv\fP contain
 .PP
 .PP
 .nf
-
 Easting,Northing,Elevation
 86943.4,891957,139.13
 87124.3,892075,135.01
@@ -207,12 +205,11 @@ 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"/> 
+        <GeometryType>wkbPoint</GeometryType> 
+        <GeometryField encoding="PointFromColumns" x="Easting" y="Northing" z="Elevation"/> 
     </OGRVRTLayer>
 </OGRVRTDataSource>
 .fi
@@ -224,7 +221,6 @@ If your CSV file does not contain column headers then it can be handled in the f
 .PP
 .PP
 .nf
-
 <GeometryField encoding="PointFromColumns" x="field_1" y="field_2" z="field_3"/>
 .fi
 .PP
@@ -236,7 +232,6 @@ The following would create raster TIFF file from VRT datasource described in \fB
 .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
@@ -245,10 +240,9 @@ The next command does the same thing as the previous one, but reads values to in
 .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 --config GDAL_NUM_THREADS ALL_CPUS
 .fi
 .PP
 .SH "AUTHORS"
 .PP
-Andrey Kiselev <dron at ak4719.spb.edu> 
+Andrey Kiselev dron at ak4719.spb.edu 
diff --git a/man/man1/gdal_merge.1 b/man/man1/gdal_merge.1
index f9ee33f..277f317 100644
--- a/man/man1/gdal_merge.1
+++ b/man/man1/gdal_merge.1
@@ -1,4 +1,4 @@
-.TH "gdal_merge" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "gdal_merge" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -8,7 +8,6 @@ mosaics a set of images
 .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...]"]
@@ -59,7 +58,6 @@ 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
@@ -68,10 +66,9 @@ Create an RGB image that shows blue in pixels with no data\&. The first two band
 .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> 
+Frank Warmerdam warmerdam at pobox.com, Silke Reimer silke at intevation.de 
diff --git a/man/man1/gdal_polygonize.1 b/man/man1/gdal_polygonize.1
index 6013e76..571aaf9 100644
--- a/man/man1/gdal_polygonize.1
+++ b/man/man1/gdal_polygonize.1
@@ -1,4 +1,4 @@
-.TH "gdal_polygonize" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "gdal_polygonize" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -8,7 +8,6 @@ produces a polygon feature layer from a raster
 .PP
 .PP
 .nf
-
 gdal_polygonize.py [-8] [-nomask] [-mask filename] raster_file [-b band]
                 [-q] [-f ogr_format] out_file [layer] [fieldname]
 .fi
@@ -55,4 +54,4 @@ The script runs in quiet mode\&. The progress monitor is suppressed and routine
 .PP
 .SH "AUTHORS"
 .PP
-Frank Warmerdam <warmerdam at pobox.com> 
+Frank Warmerdam warmerdam at pobox.com 
diff --git a/man/man1/gdal_proximity.1 b/man/man1/gdal_proximity.1
index 91b118f..7df7394 100644
--- a/man/man1/gdal_proximity.1
+++ b/man/man1/gdal_proximity.1
@@ -1,4 +1,4 @@
-.TH "gdal_proximity" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "gdal_proximity" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -8,7 +8,6 @@ produces a raster proximity map
 .PP
 .PP
 .nf
-
 gdal_proximity.py srcfile dstfile [-srcband n] [-dstband n] 
                   [-of format] [-co name=value]*
                   [-ot Byte/Int16/Int32/Float32/etc]
@@ -63,4 +62,4 @@ Specify a value to be applied to all pixels that are within the -maxdist of targ
 .PP
 .SH "AUTHORS"
 .PP
-Frank Warmerdam <warmerdam at pobox.com> 
+Frank Warmerdam warmerdam at pobox.com 
diff --git a/man/man1/gdal_rasterize.1 b/man/man1/gdal_rasterize.1
index a9f7146..07f10cc 100644
--- a/man/man1/gdal_rasterize.1
+++ b/man/man1/gdal_rasterize.1
@@ -1,4 +1,4 @@
-.TH "gdal_rasterize" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "gdal_rasterize" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -8,7 +8,6 @@ burns vector geometries into a raster
 .PP
 .PP
 .nf
-
 Usage: gdal_rasterize [-b band]* [-i] [-at]
        [-burn value]* | [-a attribute_name] [-3d]
        [-l layername]* [-where expression] [-sql select_statement]
@@ -101,7 +100,6 @@ The following would burn all polygons from mask\&.shp into the RGB TIFF file wor
 .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
@@ -110,10 +108,9 @@ The following would burn all 'class A' buildings into the output elevation file,
 .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> 
+Frank Warmerdam warmerdam at pobox.com 
diff --git a/man/man1/gdal_retile.1 b/man/man1/gdal_retile.1
index 802653d..b939de1 100644
--- a/man/man1/gdal_retile.1
+++ b/man/man1/gdal_retile.1
@@ -1,4 +1,4 @@
-.TH "gdal_retile" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "gdal_retile" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -9,8 +9,6 @@ gdal_retile\&.py retiles a set of tiles and/or build tiled pyramid levels
 .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}]'
@@ -20,9 +18,7 @@ gdal_retile.py [-v] [-co NAME=VALUE]* [-of out_format] [-ps pixelWidth pixelHeig
                [-r {near/bilinear/cubic/cubicspline/lanczos}]
                -levels numberoflevels
                [-useDirForEachRow]   
-               -targetDir TileDirectory input_files
-
-.fi
+               -targetDir TileDirectory input_files.fi
 .PP
  
 .SH "DESCRIPTION"
@@ -66,4 +62,4 @@ Normally the tiles of the base image are stored as described in \fB-targetDir\fP
 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> 
+Christian Mueller christian.mueller at nvoe.at 
diff --git a/man/man1/gdal_sieve.1 b/man/man1/gdal_sieve.1
index 36bd9c6..b1767b9 100644
--- a/man/man1/gdal_sieve.1
+++ b/man/man1/gdal_sieve.1
@@ -1,4 +1,4 @@
-.TH "gdal_sieve" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "gdal_sieve" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -8,7 +8,6 @@ removes small raster polygons
 .PP
 .PP
 .nf
-
 gdal_sieve.py [-q] [-st threshold] [-4] [-8] [-o name=value]
            srcfile [-nomask] [-mask filename] [-of format] [dstfile]
 .fi
@@ -52,4 +51,4 @@ Select the output format\&. The default is GeoTIFF (GTiff)\&. Use the short form
 .PP
 .SH "AUTHORS"
 .PP
-Frank Warmerdam <warmerdam at pobox.com> 
+Frank Warmerdam warmerdam at pobox.com 
diff --git a/man/man1/gdal_translate.1 b/man/man1/gdal_translate.1
index ec68c49..18fe8a7 100644
--- a/man/man1/gdal_translate.1
+++ b/man/man1/gdal_translate.1
@@ -1,4 +1,4 @@
-.TH "gdal_translate" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "gdal_translate" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -8,7 +8,6 @@ converts raster data between different formats
 .PP
 .PP
 .nf
-
 gdal_translate [--help-general]
        [-ot {Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/
              CInt16/CInt32/CFloat32/CFloat64}] [-strict]
@@ -95,7 +94,6 @@ The destination file name\&.
 .PP
 .PP
 .nf
-
 gdal_translate -of GTiff -co "TILED=YES" utm.tif utm_tiled.tif
 .fi
 .PP
@@ -103,7 +101,6 @@ gdal_translate -of GTiff -co "TILED=YES" utm.tif utm_tiled.tif
 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
@@ -112,11 +109,10 @@ gdal_translate rgba.tif withmask.tif -b 1 -b 2 -b 3 -mask 4 -co COMPRESS=JPEG -c
 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> 
+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
index 3ea51f2..e5ef7d3 100644
--- a/man/man1/gdal_utilities.1
+++ b/man/man1/gdal_utilities.1
@@ -1,4 +1,4 @@
-.TH "gdal_utilities" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "gdal_utilities" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdaladdo.1 b/man/man1/gdaladdo.1
index d66c807..7910857 100644
--- a/man/man1/gdaladdo.1
+++ b/man/man1/gdaladdo.1
@@ -1,4 +1,4 @@
-.TH "gdaladdo" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "gdaladdo" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -8,7 +8,6 @@ builds or rebuilds overview images
 .PP
 .PP
 .nf
-
 gdaladdo [-r {nearest,average,gauss,cubic,cubicspline,lanczos,average_mp,average_magphase,mode}]
          [-b band]
          [-ro] [-clean] [-oo NAME=VALUE]* [--help-general] filename levels
@@ -56,7 +55,6 @@ For LZW or DEFLATE compressed external overviews, the predictor value can be set
 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
@@ -72,7 +70,7 @@ 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\&. 
+IF_SAFER will create BigTIFF if the resulting file \fImight\fP exceed 4GB\&. 
 .PP
 
 .br
@@ -85,7 +83,6 @@ Create overviews, embedded in the supplied TIFF file:
 .PP
 .PP
 .nf
-
 gdaladdo -r average abc.tif 2 4 8 16
 .fi
 .PP
@@ -94,7 +91,6 @@ 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
@@ -103,7 +99,6 @@ Create an external JPEG-compressed GeoTIFF overview file from a 3-band RGB datas
 .PP
 .PP
 .nf
-
 gdaladdo --config COMPRESS_OVERVIEW JPEG --config PHOTOMETRIC_OVERVIEW YCBCR
          --config INTERLEAVE_OVERVIEW PIXEL rgb_dataset.ext 2 4 8 16
 .fi
@@ -113,10 +108,9 @@ 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> 
+Frank Warmerdam warmerdam at pobox.com, Silke Reimer silke at intevation.de 
diff --git a/man/man1/gdalbuildvrt.1 b/man/man1/gdalbuildvrt.1
index 52004e0..c41a55a 100644
--- a/man/man1/gdalbuildvrt.1
+++ b/man/man1/gdalbuildvrt.1
@@ -1,4 +1,4 @@
-.TH "gdalbuildvrt" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "gdalbuildvrt" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -8,7 +8,6 @@ Builds a VRT from a list of datasets\&. (compiled by default since GDAL 1\&.6\&.
 .PP
 .PP
 .nf
-
 gdalbuildvrt [-tileindex field_name]
              [-resolution {highest|lowest|average|user}]
              [-te xmin ymin xmax ymax] [-tr xres yres] [-tap]
@@ -96,7 +95,6 @@ Overwrite the VRT if it already exists\&.
 Make a virtual mosaic from all TIFF files contained in a directory : 
 .PP
 .nf
-
 gdalbuildvrt doq_index.vrt doq/*.tif
 
 .fi
@@ -105,7 +103,6 @@ gdalbuildvrt doq_index.vrt doq/*.tif
 Make a virtual mosaic from files whose name is specified in a text file : 
 .PP
 .nf
-
 gdalbuildvrt -input_file_list my_liste.txt doq_index.vrt
 
 .fi
@@ -114,7 +111,6 @@ gdalbuildvrt -input_file_list my_liste.txt doq_index.vrt
 Make a RGB virtual mosaic from 3 single-band input files : 
 .PP
 .nf
-
 gdalbuildvrt -separate rgb.vrt red.tif green.tif blue.tif
 
 .fi
@@ -123,11 +119,10 @@ gdalbuildvrt -separate rgb.vrt red.tif green.tif blue.tif
 Make a virtual mosaic with blue background colour (RGB: 0 0 255) : 
 .PP
 .nf
-
 gdalbuildvrt -hidenodata -vrtnodata "0 0 255" doq_index.vrt doq/*.tif
 
 .fi
 .PP
 .SH "AUTHOR"
 .PP
-Even Rouault <even.rouault at mines-paris.org> 
+Even Rouault even.rouault at mines-paris.org 
diff --git a/man/man1/gdalcompare.1 b/man/man1/gdalcompare.1
index 37d307f..fb6ec6a 100644
--- a/man/man1/gdalcompare.1
+++ b/man/man1/gdalcompare.1
@@ -1,4 +1,4 @@
-.TH "gdalcompare" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "gdalcompare" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -8,7 +8,6 @@ compare two images
 .PP
 .PP
 .nf
-
 gdalcompare.py [-sds] golden_file new_file
 .fi
 .PP
@@ -32,4 +31,4 @@ The file being compared to the golden file, referred to as the new file\&.
 Note that the gdalcompare\&.py script can also be called as a library from python code though it is not typically in the python path for including\&. The primary entry point is gdalcompare\&.compare() which takes a golden gdal\&.Dataset and a new gdal\&.Dataset as arguments and returns a difference count (excluding the binary comparison)\&. The gdalcompare\&.compare_sds() entry point can be used to compare subdatasets\&.
 .SH "AUTHORS"
 .PP
-Frank Warmerdam <warmerdam at pobox.com> 
+Frank Warmerdam warmerdam at pobox.com 
diff --git a/man/man1/gdaldem.1 b/man/man1/gdaldem.1
index 9002539..80eabe4 100644
--- a/man/man1/gdaldem.1
+++ b/man/man1/gdaldem.1
@@ -1,4 +1,4 @@
-.TH "gdaldem" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "gdaldem" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -9,8 +9,6 @@ Tools to analyze and visualize DEMs\&. (since GDAL 1\&.7\&.0)
 .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)]"
@@ -57,9 +55,7 @@ Notes :
   longitude are similar, elevation (z) units can be converted to be compatible
   by using scale=370400 (if elevation is in feet) or scale=111120 (if elevation is in 
   meters).  For locations not near the equator, it would be best to reproject your
-  grid using gdalwarp before using gdaldem.
-
-.fi
+  grid using gdalwarp before using gdaldem..fi
 .PP
  
 .SH "DESCRIPTION"
@@ -173,7 +169,6 @@ Note: the syntax of the color configuration file is derived from the one support
 For example : 
 .PP
 .nf
-
 3500   white
 2500   235:220:175
 50%   190 185 135
@@ -203,7 +198,7 @@ The value -9999 is used as the output nodata value\&.
 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>
+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"
diff --git a/man/man1/gdalinfo.1 b/man/man1/gdalinfo.1
index 404dcb7..9b6fced 100644
--- a/man/man1/gdalinfo.1
+++ b/man/man1/gdalinfo.1
@@ -1,4 +1,4 @@
-.TH "gdalinfo" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "gdalinfo" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -8,7 +8,6 @@ lists information about a raster dataset
 .PP
 .PP
 .nf
-
 gdalinfo [--help-general] [-json] [-mm] [-stats] [-hist] [-nogcp] [-nomd]
          [-norat] [-noct] [-nofl] [-checksum] [-proj4]
          [-listmdd] [-mdd domain|`all`]*
@@ -94,7 +93,6 @@ Band pseudo-color tables\&.
 .PP
 .PP
 .nf
-
 gdalinfo ~/openev/utm.tif 
 Driver: GTiff/GeoTIFF
 Size is 512, 512
@@ -125,4 +123,4 @@ Band 1 Block=512x16 Type=Byte, ColorInterp=Gray
 .PP
 .SH "AUTHORS"
 .PP
-Frank Warmerdam <warmerdam at pobox.com>, Silke Reimer <silke at intevation.de> 
+Frank Warmerdam warmerdam at pobox.com, Silke Reimer silke at intevation.de 
diff --git a/man/man1/gdallocationinfo.1 b/man/man1/gdallocationinfo.1
index e7cb17d..ff616da 100644
--- a/man/man1/gdallocationinfo.1
+++ b/man/man1/gdallocationinfo.1
@@ -1,4 +1,4 @@
-.TH "gdallocationinfo" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "gdallocationinfo" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -9,7 +9,6 @@ raster query tool
 .PP
 .PP
 .nf
-
 Usage: gdallocationinfo [--help-general] [-xml] [-lifonly] [-valonly]
                         [-b band]* [-overview overview_level]
                         [-l_srs srs_def] [-geoloc] [-wgs84]
@@ -84,7 +83,6 @@ Simple example reporting on pixel (256,256) on the file utm\&.tif\&.
 .PP
 .PP
 .nf
-
 $ gdallocationinfo utm.tif 256 256
 Report:
   Location: (256P,256L)
@@ -97,7 +95,6 @@ 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">
@@ -111,4 +108,4 @@ $ gdallocationinfo -xml -wgs84 utm.vrt -117.5 33.75
 .PP
 .SH "AUTHORS"
 .PP
-Frank Warmerdam <warmerdam at pobox.com> 
+Frank Warmerdam warmerdam at pobox.com 
diff --git a/man/man1/gdalmanage.1 b/man/man1/gdalmanage.1
index 3313f27..1e5c52c 100644
--- a/man/man1/gdalmanage.1
+++ b/man/man1/gdalmanage.1
@@ -1,4 +1,4 @@
-.TH "gdalmanage" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "gdalmanage" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -8,7 +8,6 @@ Identify, delete, rename and copy raster data files
 .PP
 .PP
 .nf
-
 Usage: gdalmanage mode [-r] [-u] [-f format]
                   datasetname [newdatasetname]
 .fi
@@ -48,7 +47,6 @@ Report the data format of the raster file by using the \fIidentify\fP mode and s
 .PP
 .PP
 .nf
-
 $ gdalmanage identify NE1_50M_SR_W.tif
 
 NE1_50M_SR_W.tif: GTiff
@@ -59,7 +57,6 @@ Recursive mode will scan subfolders and report the data format:
 .PP
 .PP
 .nf
-
 $ gdalmanage identify -r 50m_raster/
 
 NE1_50M_SR_W/ne1_50m.jpg: JPEG
@@ -70,9 +67,7 @@ NE1_50M_SR_W/ne1_50m_print.png: PNG
 NE1_50M_SR_W/NE1_50M_SR_W.aux: HFA
 NE1_50M_SR_W/NE1_50M_SR_W.tif: GTiff
 NE1_50M_SR_W/ne1_50m_sub.tif: GTiff
-NE1_50M_SR_W/ne1_50m_sub2.tif: GTiff
-
-.fi
+NE1_50M_SR_W/ne1_50m_sub2.tif: GTiff.fi
 .PP
  
 .SS "Using copy mode"
@@ -80,7 +75,6 @@ Copy the raster data:
 .PP
 .PP
 .nf
-
 $ gdalmanage copy NE1_50M_SR_W.tif ne1_copy.tif
 .fi
 .PP
@@ -88,7 +82,6 @@ $ gdalmanage copy NE1_50M_SR_W.tif ne1_copy.tif
 Rename raster data: 
 .PP
 .nf
-
 $ gdalmanage rename NE1_50M_SR_W.tif ne1_rename.tif
 
 .fi
@@ -98,10 +91,9 @@ Delete the raster data:
 .PP
 .PP
 .nf
-
 gdalmanage delete NE1_50M_SR_W.tif
 .fi
 .PP
 .SH "AUTHORS"
 .PP
-Tyler Mitchell <spatialguru at shaw.ca> 
+Tyler Mitchell spatialguru at shaw.ca 
diff --git a/man/man1/gdalmove.1 b/man/man1/gdalmove.1
index 7debfe6..005c7ae 100644
--- a/man/man1/gdalmove.1
+++ b/man/man1/gdalmove.1
@@ -1,4 +1,4 @@
-.TH "gdalmove" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "gdalmove" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -8,7 +8,6 @@ Transform georeferencing of raster file in place
 .PP
 .PP
 .nf
-
 gdalmove.py [-s_srs <srs_defn>] -t_srs <srs_defn>
             [-et <max_pixel_err>] target_file
 .fi
@@ -39,4 +38,4 @@ The file to be operated on\&. To update this must be a file format that supports
 .PP
 .SH "AUTHORS"
 .PP
-Frank Warmerdam <warmerdam at pobox.com> 
+Frank Warmerdam warmerdam at pobox.com 
diff --git a/man/man1/gdalsrsinfo.1 b/man/man1/gdalsrsinfo.1
index 6ca154b..c9b17f1 100644
--- a/man/man1/gdalsrsinfo.1
+++ b/man/man1/gdalsrsinfo.1
@@ -1,4 +1,4 @@
-.TH "gdalsrsinfo" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "gdalsrsinfo" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -8,7 +8,6 @@ lists info about a given SRS in number of formats (WKT, PROJ\&.4, etc\&.)
 .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
@@ -20,9 +19,7 @@ Options:
    [-V]                   Validate SRS
    [-o out_type]          Output type { default, all, wkt_all, proj4,
                                         wkt, wkt_simple, wkt_noct, wkt_esri,
-                                        mapinfo, xml }
-
-.fi
+                                        mapinfo, xml }.fi
 .PP
 .SH "DESCRIPTION"
 .PP
@@ -60,12 +57,10 @@ Output types:
 .PP
 
 .br
- 
 .SH "EXAMPLE"
 .PP
 .PP
 .nf
-
 $  gdalsrsinfo   "EPSG:4326"
 
 PROJ.4 : '+proj=longlat +datum=WGS84 +no_defs '
@@ -80,41 +75,31 @@ GEOGCS["WGS 84",
         AUTHORITY["EPSG","8901"]],
     UNIT["degree",0.0174532925199433,
         AUTHORITY["EPSG","9122"]],
-    AUTHORITY["EPSG","4326"]]
-
-.fi
+    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",
@@ -139,16 +124,13 @@ PROJCS["WGS 84 / UTM zone 22S",
     AXIS["Easting",EAST],
     AXIS["Northing",NORTH],
     AUTHORITY["EPSG","32722"]]
-
 .fi
 .PP
 .PP
 
 .br
- 
 .PP
 .nf
-
 $ gdalsrsinfo  -o wkt_all  "EPSG:4618"
 
 OGC WKT :
@@ -185,9 +167,8 @@ GEOGCS["SAD69",
         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> 
+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
index 511f96d..dc30546 100644
--- a/man/man1/gdaltindex.1
+++ b/man/man1/gdaltindex.1
@@ -1,4 +1,4 @@
-.TH "gdaltindex" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "gdaltindex" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -8,7 +8,6 @@ Builds a shapefile as a raster tileindex
 .PP
 .PP
 .nf
-
 gdaltindex [-f format] [-tileindex field_name] [-write_absolute_path]
            [-skip_different_projection] [-t_srs target_srs]
            [-src_srs_name field_name] [-src_srs_format [AUTO|WKT|EPSG|PROJ]
@@ -22,36 +21,46 @@ This program builds a shapefile with a record for each input raster file, an att
 .IP "\fB\fB-f\fP format:\fP" 1c
 (GDAL >= 1\&.11) 
 .PP
-The OGR format of the output tile index file\&. Default is Esri Shapefile\&.  
+The OGR format of the output tile index file\&. Default is Esri Shapefile\&.
+.PP
 .IP "\fB\fB-tileindex\fP field_name: \fP" 1c
 .PP
-The output field name to hold the file path/location to the indexed rasters\&. The default tile index field name is \fClocation\fP\&.  
+The output field name to hold the file path/location to the indexed rasters\&. The default tile index field name is \fClocation\fP\&.
+.PP
 .IP "\fB\fB-write_absolute_path\fP: \fP" 1c
 .PP
-The absolute path to the raster files is stored in the tile index file\&. By default the raster filenames will be put in the file exactly as they are specified on the command line\&.  
+The absolute path to the raster files is stored in the tile index file\&. By default the raster filenames will be put in the file exactly as they are specified on the command line\&.
+.PP
 .IP "\fB\fB-skip_different_projection\fP: \fP" 1c
 .PP
-Only files with same projection as files already inserted in the tileindex will be inserted (unless \fC-t_srs\fP is specified)\&. Default does not check projection and accepts all inputs\&.  
+Only files with same projection as files already inserted in the tileindex will be inserted (unless \fC-t_srs\fP is specified)\&. Default does not check projection and accepts all inputs\&.
+.PP
 .IP "\fB\fB-t_srs\fP target_srs: \fP" 1c
 .PP
-Geometries of input files will be transformed to the desired target coordinate reference system\&. Using this option generates files that are not compatible with MapServer < 6\&.4\&. Default creates simple rectangular polygons in the same coordinate reference system as the input rasters\&.  
+Geometries of input files will be transformed to the desired target coordinate reference system\&. Using this option generates files that are not compatible with MapServer < 6\&.4\&. Default creates simple rectangular polygons in the same coordinate reference system as the input rasters\&.
+.PP
 .IP "\fB\fB-src_srs_name\fP field_name:\fP" 1c
 (GDAL >= 1\&.11) 
 .PP
-The name of the field to store the SRS of each tile\&. This field name can be used as the value of the TILESRS keyword in MapServer >= 6\&.4\&.  
+The name of the field to store the SRS of each tile\&. This field name can be used as the value of the TILESRS keyword in MapServer >= 6\&.4\&.
+.PP
 .IP "\fB\fB-src_srs_format\fP type:\fP" 1c
 (GDAL >= 1\&.11) 
 .PP
-The format in which the SRS of each tile must be written\&. Types can be AUTO, WKT, EPSG, PROJ\&.  
+The format in which the SRS of each tile must be written\&. Types can be AUTO, WKT, EPSG, PROJ\&.
+.PP
 .IP "\fB\fB-lyr_name\fP name: \fP" 1c
 .PP
-Layer name to create/append to in the output tile index file\&.  
+Layer name to create/append to in the output tile index file\&.
+.PP
 .IP "\fB\fBindex_file\fP: \fP" 1c
 .PP
-The name of the output file to create/append to\&. The default shapefile will be created if it doesn't already exist, otherwise it will append to the existing file\&.  
+The name of the output file to create/append to\&. The default shapefile will be created if it doesn't already exist, otherwise it will append to the existing file\&.
+.PP
 .IP "\fB\fBgdal_file\fP: \fP" 1c
 .PP
-The input GDAL raster files, can be multiple files separated by spaces\&. Wildcards my also be used\&. Stores the file locations in the same style as specified here, unless \fC-write_absolute_path\fP option is also used\&.  
+The input GDAL raster files, can be multiple files separated by spaces\&. Wildcards my also be used\&. Stores the file locations in the same style as specified here, unless \fC-write_absolute_path\fP option is also used\&.
+.PP
 .PP
 .SH "EXAMPLES"
 .PP
@@ -60,7 +69,6 @@ Produce a shapefile (\fCdoq_index\&.shp\fP) with a record for every image that t
 .PP
 .PP
 .nf
-
 gdaltindex doq_index.shp doq/*.tif
 .fi
 .PP
@@ -69,10 +77,9 @@ The \fC-t_srs\fP option can also be used to transform all input rasters into the
 .PP
 .PP
 .nf
-
 gdaltindex -t_srs EPSG:4326 -src_srs_name src_srs tile_index_mixed_srs.shp *.tif
 .fi
 .PP
 .SH "AUTHOR"
 .PP
-Frank Warmerdam <warmerdam at pobox.com> 
+Frank Warmerdam warmerdam at pobox.com 
diff --git a/man/man1/gdaltransform.1 b/man/man1/gdaltransform.1
index b9c24e1..cba8099 100644
--- a/man/man1/gdaltransform.1
+++ b/man/man1/gdaltransform.1
@@ -1,4 +1,4 @@
-.TH "gdaltransform" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "gdaltransform" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -8,7 +8,6 @@ transforms coordinates
 .PP
 .PP
 .nf
-
 gdaltransform [--help-general]
     [-i] [-s_srs srs_def] [-t_srs srs_def] [-to "NAME=VALUE"]
     [-order n] [-tps] [-rpc] [-geoloc]
@@ -57,7 +56,6 @@ Simple reprojection from one projected coordinate system to another:
 .PP
 .PP
 .nf
-
 gdaltransform -s_srs EPSG:28992 -t_srs EPSG:31370
 177502 311865
 .fi
@@ -68,7 +66,6 @@ Produces the following output in meters in the 'Belge 1972 / Belgian Lambert
 .PP
 .PP
 .nf
-
 244510.77404604 166154.532871342 -1046.79270555763
 .fi
 .PP
@@ -78,7 +75,6 @@ The following command requests an RPC based transformation using the RPC model a
 .PP
 .PP
 .nf
-
 gdaltransform -i -rpc 06OCT20025052-P2AS-005553965230_01_P001.TIF
 125.67206 39.85307 50                    
 .fi
@@ -87,11 +83,10 @@ gdaltransform -i -rpc 06OCT20025052-P2AS-005553965230_01_P001.TIF
 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> 
+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
index a025722..39c1592 100644
--- a/man/man1/gdalwarp.1
+++ b/man/man1/gdalwarp.1
@@ -1,4 +1,4 @@
-.TH "gdalwarp" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "gdalwarp" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -9,7 +9,6 @@ image reprojection and warping utility
 .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]
@@ -148,7 +147,6 @@ For instance, an eight bit spot scene stored in GeoTIFF with control points mapp
 .PP
 .PP
 .nf
-
 gdalwarp -t_srs '+proj=utm +zone=11 +datum=WGS84' raw_spot.tif utm11.tif
 .fi
 .PP
@@ -157,7 +155,6 @@ For instance, the second channel of an ASTER image stored in HDF with control po
 .PP
 .PP
 .nf
-
 gdalwarp HDF4_SDS:ASTER_L1B:"pg-PR1B0000-2002031402_100_001":2 pg-PR1B0000-2002031402_100_001_2.tif
 .fi
 .PP
@@ -166,4 +163,4 @@ gdalwarp HDF4_SDS:ASTER_L1B:"pg-PR1B0000-2002031402_100_001":2 pg-PR1B0000-20020
 http://trac.osgeo.org/gdal/wiki/UserDocs/GdalWarp : Wiki page discussing options and behaviours of gdalwarp
 .SH "AUTHORS"
 .PP
-Frank Warmerdam <warmerdam at pobox.com>, Silke Reimer <silke at intevation.de> 
+Frank Warmerdam warmerdam at pobox.com, Silke Reimer silke at intevation.de 
diff --git a/man/man1/nearblack.1 b/man/man1/nearblack.1
index 5973c5d..5f87fc6 100644
--- a/man/man1/nearblack.1
+++ b/man/man1/nearblack.1
@@ -1,4 +1,4 @@
-.TH "nearblack" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "nearblack" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -8,7 +8,6 @@ convert nearly black/white borders to black
 .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
@@ -48,4 +47,4 @@ The processing is all done in 8bit (Bytes)\&.
 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> 
+Frank Warmerdam warmerdam at pobox.com 
diff --git a/man/man1/ogr2ogr.1 b/man/man1/ogr2ogr.1
index bbc9d1d..631665b 100644
--- a/man/man1/ogr2ogr.1
+++ b/man/man1/ogr2ogr.1
@@ -1,4 +1,4 @@
-.TH "ogr2ogr" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "ogr2ogr" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -9,7 +9,6 @@ converts simple features data between file formats
 .PP
 .PP
 .nf
-
 Usage: ogr2ogr [--help-general] [-skipfailures] [-append] [-update]
                [-select field_list] [-where restricted_where] 
                [-progress] [-sql <sql statement>] [-dialect dialect]
@@ -41,9 +40,7 @@ Advanced options :
                [-splitlistfields] [-maxsubfields val]
                [-explodecollections] [-zfield field_name]
                [-gcp pixel line easting northing [elevation]]* [-order n | -tps]
-               [-nomd] [-mo \"META-TAG=VALUE\"]*
-
-.fi
+               [-nomd] [-mo \"META-TAG=VALUE\"]*.fi
 .PP
 .SH "DESCRIPTION"
 .PP
@@ -53,13 +50,11 @@ This program can be used to convert simple features data between file formats pe
 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
   
@@ -196,7 +191,6 @@ 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
@@ -205,7 +199,6 @@ Example reprojecting from ETRS_1989_LAEA_52N_10E to EPSG:4326 and clipping to a
 .PP
 .PP
 .nf
-
 % ogr2ogr -wrapdateline -t_srs EPSG:4326 -clipdst -5 40 15 55 france_4326.shp europe_laea.shp
 .fi
 .PP
@@ -214,7 +207,6 @@ Example for using the -fieldmap setting\&. The first field of the source layer i
 .PP
 .PP
 .nf
-
 % ogr2ogr -append -fieldmap 2,-1,4 dst.shp src.shp
 .fi
 .PP
@@ -222,4 +214,4 @@ Example for using the -fieldmap setting\&. The first field of the source layer i
 More examples are given in the individual format pages\&.
 .SH "AUTHOR"
 .PP
-Frank Warmerdam <warmerdam at pobox.com>, Silke Reimer <silke at intevation.de> 
+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
index e0c52ea..84ea685 100644
--- a/man/man1/ogr_utilities.1
+++ b/man/man1/ogr_utilities.1
@@ -1,4 +1,4 @@
-.TH "ogr_utilities" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "ogr_utilities" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/ogrinfo.1 b/man/man1/ogrinfo.1
index fd105ae..8e29681 100644
--- a/man/man1/ogrinfo.1
+++ b/man/man1/ogrinfo.1
@@ -1,4 +1,4 @@
-.TH "ogrinfo" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "ogrinfo" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -9,16 +9,13 @@ lists information about an OGR supported data source
 .PP
 .PP
 .nf
-
 ogrinfo [--help-general] [-ro] [-q] [-where restricted_where]
         [-spat xmin ymin xmax ymax] [-geomfield field] [-fid fid]
         [-sql statement] [-dialect dialect] [-al] [-so] [-fields={YES/NO}]
         [-geom={YES/NO/SUMMARY}] [-formats] [[-oo NAME=VALUE] ...]
         [-nomd] [-listmdd] [-mdd domain|`all`]*
         [-nocount] [-noextent]
-        datasource_name [layer [layer ...]]
-
-.fi
+        datasource_name [layer [layer ...]].fi
 .PP
 .SH "DESCRIPTION"
 .PP
@@ -76,7 +73,6 @@ Geometries are reported in OGC WKT format\&.
 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.
@@ -91,7 +87,6 @@ using driver `UK .NTF' successful.
 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.
@@ -149,4 +144,4 @@ OGRFeature(BL2000_LINK):2
 .PP
 .SH "AUTHORS"
 .PP
-Frank Warmerdam <warmerdam at pobox.com>, Silke Reimer <silke at intevation.de> 
+Frank Warmerdam warmerdam at pobox.com, Silke Reimer silke at intevation.de 
diff --git a/man/man1/ogrlineref.1 b/man/man1/ogrlineref.1
index 2d78a86..b90a319 100644
--- a/man/man1/ogrlineref.1
+++ b/man/man1/ogrlineref.1
@@ -1,4 +1,4 @@
-.TH "ogrlineref" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "ogrlineref" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -18,7 +18,6 @@ return the portion of the path according to the 'linear referenced' begin and en
 .PP
 .PP
 .nf
-
 ogrlineref [--help-general] [-progress] [-quiet]
            [-f format_name] [[-dsco NAME=VALUE] ...] [[-lco NAME=VALUE]...]
            [-create]
@@ -97,11 +96,10 @@ The input end linear distance
 This example would create a shapefile (parts\&.shp) containing a data needed for linear referencing (1 km parts): 
 .PP
 .nf
-
 % ogrlineref -create -l roads.shp -p references.shp -pm dist -o parts.shp -s 1000 -progress
 
 .fi
 .PP
 .SH "AUTHORS"
 .PP
-Dmitry Baryshnikov <polimax at mail.ru> 
+Dmitry Baryshnikov polimax at mail.ru 
diff --git a/man/man1/ogrtindex.1 b/man/man1/ogrtindex.1
index f486252..84fcb35 100644
--- a/man/man1/ogrtindex.1
+++ b/man/man1/ogrtindex.1
@@ -1,4 +1,4 @@
-.TH "ogrtindex" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "ogrtindex" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -9,7 +9,6 @@ creates a tileindex
 .PP
 .PP
 .nf
-
 ogrtindex [-lnum n]... [-lname name]... [-f output_format]
           [-write_absolute_path] [-skip_different_projection]
                  output_dataset src_dataset...
@@ -45,11 +44,10 @@ It is a flaw of the current ogrtindex program that no attempt is made to copy th
 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> 
+Frank Warmerdam warmerdam at pobox.com, Silke Reimer silke at intevation.de 
diff --git a/man/man1/pct2rgb.1 b/man/man1/pct2rgb.1
index 9817f45..2483c06 100644
--- a/man/man1/pct2rgb.1
+++ b/man/man1/pct2rgb.1
@@ -1,4 +1,4 @@
-.TH "pct2rgb" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "pct2rgb" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -9,7 +9,6 @@ Convert an 8bit paletted image to 24bit RGB
 .PP
 .PP
 .nf
-
 pct2rgb.py [-of format] [-b band] [-rgba] source_file dest_file
 .fi
 .PP
@@ -34,4 +33,4 @@ NOTE: pct2rgb\&.py is a Python script, and will only work if GDAL was built with
 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> 
+Frank Warmerdam warmerdam at pobox.com, Silke Reimer silke at intevation.de 
diff --git a/man/man1/rgb2pct.1 b/man/man1/rgb2pct.1
index a464633..9543ca5 100644
--- a/man/man1/rgb2pct.1
+++ b/man/man1/rgb2pct.1
@@ -1,4 +1,4 @@
-.TH "rgb2pct" 1 "Tue Sep 15 2015" "GDAL" \" -*- nroff -*-
+.TH "rgb2pct" 1 "Fri Jan 22 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -8,7 +8,6 @@ Convert a 24bit RGB image to 8bit paletted
 .PP
 .PP
 .nf
-
 rgb2pct.py [-n colors | -pct palette_file] [-of format] source_file dest_file
 .fi
 .PP
@@ -35,7 +34,6 @@ If it is desired to hand create the palette, likely the simplest text format is
 .PP
 .PP
 .nf
-
 % rgb2pct.py -pct palette.vrt rgb.tif pseudo-colored.tif
 % more < palette.vrt
 <VRTDataset rasterXSize="226" rasterYSize="271">
@@ -53,4 +51,4 @@ If it is desired to hand create the palette, likely the simplest text format is
 .PP
 .SH "AUTHOR"
 .PP
-Frank Warmerdam <warmerdam at pobox.com> 
+Frank Warmerdam warmerdam at pobox.com 
diff --git a/nmake.opt b/nmake.opt
index 3321e40..bc4c93a 100644
--- a/nmake.opt
+++ b/nmake.opt
@@ -1,4 +1,4 @@
-# $Id: nmake.opt 29634 2015-08-12 12:03:07Z rouault $
+# $Id: nmake.opt 32023 2015-12-06 12:13:58Z rouault $
 #
 # nmake.opt - main configuration file for NMAKE makefiles.
 #
@@ -644,8 +644,13 @@ GDALLIB	=    $(GDAL_ROOT)/gdal.lib
 !ENDIF
 
 !IFDEF ODBC_SUPPORTED
+!IF $(MSVC_VER) >= 1900
+# legacy_stdio_definitions.lib : https://connect.microsoft.com/VisualStudio/feedback/details/1134693/vs-2015-ctp-5-c-vsnwprintf-s-and-other-functions-are-not-exported-in-appcrt140-dll-breaking-linkage-of-static-libraries
+ODBCLIB = legacy_stdio_definitions.lib odbc32.lib odbccp32.lib user32.lib
+!ELSE
 ODBCLIB = odbc32.lib odbccp32.lib user32.lib
 !ENDIF
+!ENDIF
 
 !IF DEFINED(MRSID_DIR) || DEFINED(MRSID_RASTER_DIR) || DEFINED(MRSID_LIDAR_DIR)
 !IF "$(MRSID_PLUGIN)" != "YES"
diff --git a/ogr/ogr_srs_api.h b/ogr/ogr_srs_api.h
index afb08ee..4d66a47 100644
--- a/ogr/ogr_srs_api.h
+++ b/ogr/ogr_srs_api.h
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogr_srs_api.h 28972 2015-04-22 10:39:11Z rouault $
+ * $Id: ogr_srs_api.h 31181 2015-10-28 15:02:25Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  C API and constant declarations for OGR Spatial References.
@@ -462,7 +462,8 @@ int    CPL_DLL OSREPSGTreatsAsNorthingEasting( OGRSpatialReferenceH hSRS );
 const char CPL_DLL *OSRGetAxis( OGRSpatialReferenceH hSRS,
                                 const char *pszTargetKey, int iAxis, 
                                 OGRAxisOrientation *peOrientation );
-OGRErr CPL_DLL OSRSetAxes( const char *pszTargetKey,
+OGRErr CPL_DLL OSRSetAxes( OGRSpatialReferenceH hSRS, 
+                           const char *pszTargetKey,
                            const char *pszXAxisName,
                            OGRAxisOrientation eXAxisOrientation,
                            const char *pszYAxisName, 
@@ -560,6 +561,13 @@ OGRErr CPL_DLL OSRSetHOM( OGRSpatialReferenceH hSRS,
                           double dfScale,
                           double dfFalseEasting, double dfFalseNorthing );
 
+OGRErr CPL_DLL OSRSetHOMAC( OGRSpatialReferenceH hSRS, 
+                    double dfCenterLat, double dfCenterLong,
+                    double dfAzimuth, double dfRectToSkew, 
+                    double dfScale,
+                    double dfFalseEasting,
+                    double dfFalseNorthing );
+
 /** Hotine Oblique Mercator using two points on centerline */
 OGRErr CPL_DLL OSRSetHOM2PNO( OGRSpatialReferenceH hSRS, double dfCenterLat,
                               double dfLat1, double dfLong1,
@@ -614,6 +622,10 @@ OGRErr CPL_DLL OSRSetMercator( OGRSpatialReferenceH hSRS,
                                double dfCenterLat, double dfCenterLong,
                                double dfScale, 
                                double dfFalseEasting, double dfFalseNorthing );
+OGRErr CPL_DLL OSRSetMercator2SP( OGRSpatialReferenceH hSRS, 
+                          double dfStdP1,
+                          double dfCenterLat, double dfCenterLong,
+                          double dfFalseEasting, double dfFalseNorthing );
 
 /** Mollweide */
 OGRErr CPL_DLL  OSRSetMollweide( OGRSpatialReferenceH hSRS,
@@ -701,6 +713,11 @@ OGRErr CPL_DLL OSRSetTMSO( OGRSpatialReferenceH hSRS,
                            double dfScale,
                            double dfFalseEasting, double dfFalseNorthing );
 
+OGRErr CPL_DLL OSRSetTPED( OGRSpatialReferenceH hSRS,
+                   double dfLat1, double dfLong1,
+                   double dfLat2, double dfLong2,
+                   double dfFalseEasting, double dfFalseNorthing );
+
 /** VanDerGrinten */
 OGRErr CPL_DLL OSRSetVDG( OGRSpatialReferenceH hSRS,
                           double dfCenterLong,
@@ -708,6 +725,7 @@ OGRErr CPL_DLL OSRSetVDG( OGRSpatialReferenceH hSRS,
 
 /** Wagner I -- VII */
 OGRErr CPL_DLL OSRSetWagner( OGRSpatialReferenceH hSRS, int nVariation,
+                             double dfCenterLat,
                              double dfFalseEasting,
                              double dfFalseNorthing );
 
diff --git a/ogr/ogr_srs_esri.cpp b/ogr/ogr_srs_esri.cpp
index d54dd06..0e8953a 100644
--- a/ogr/ogr_srs_esri.cpp
+++ b/ogr/ogr_srs_esri.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogr_srs_esri.cpp 29518 2015-07-11 10:58:41Z rouault $
+ * $Id: ogr_srs_esri.cpp 30733 2015-09-28 19:41:53Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  OGRSpatialReference translation to/from ESRI .prj definitions.
@@ -36,7 +36,7 @@
 
 #include "ogr_srs_esri_names.h"
 
-CPL_CVSID("$Id: ogr_srs_esri.cpp 29518 2015-07-11 10:58:41Z rouault $");
+CPL_CVSID("$Id: ogr_srs_esri.cpp 30733 2015-09-28 19:41:53Z rouault $");
 
 void  SetNewName( OGRSpatialReference* pOgr, const char* keyName, const char* newName );
 int   RemapImgWGSProjcsName(OGRSpatialReference* pOgr, const char* pszProjCSName, 
@@ -1614,6 +1614,13 @@ OGRErr OGRSpatialReference::morphFromESRI()
         pszProjection = GetAttrValue("PROJECTION");
     }
 
+    if( pszProjection != NULL &&
+             EQUAL(pszProjection, SRS_PT_MERCATOR_AUXILIARY_SPHERE) )
+    {
+        CPLFree( pszDatumOrig );
+        return importFromEPSG(3857);
+    }
+
 /* -------------------------------------------------------------------- */
 /*      If we are remapping Hotine_Oblique_Mercator_Azimuth_Center      */
 /*      add a rectified_grid_angle parameter - to match the azimuth     */
@@ -1696,6 +1703,14 @@ OGRErr OGRSpatialReference::morphFromESRI()
 /* -------------------------------------------------------------------- */
     if( pszProjection != NULL && EQUAL(pszProjection,"Mercator") )
     {
+        /* Such as found in #6134 */
+        if( GetAttrValue("PROJCS") != NULL &&
+            EQUAL(GetAttrValue("PROJCS"), "WGS_84_Pseudo_Mercator"))
+        {
+            CPLFree( pszDatumOrig );
+            return importFromEPSG(3857);
+        }
+
         SetNode( "PROJCS|PROJECTION", SRS_PT_MERCATOR_2SP );
         pszProjection = GetAttrValue("PROJECTION");
     }
diff --git a/ogr/ogrfeature.cpp b/ogr/ogrfeature.cpp
index a1cd3a6..523b9c8 100644
--- a/ogr/ogrfeature.cpp
+++ b/ogr/ogrfeature.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrfeature.cpp 28900 2015-04-14 09:40:34Z rouault $
+ * $Id: ogrfeature.cpp 33000 2016-01-15 15:01:06Z rouault $
  * 
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  The OGRFeature class implementation. 
@@ -35,7 +35,7 @@
 #include <vector>
 #include <errno.h>
 
-CPL_CVSID("$Id: ogrfeature.cpp 28900 2015-04-14 09:40:34Z rouault $");
+CPL_CVSID("$Id: ogrfeature.cpp 33000 2016-01-15 15:01:06Z rouault $");
 
 /************************************************************************/
 /*                             OGRFeature()                             */
@@ -647,8 +647,11 @@ OGRErr OGRFeature::SetGeomFieldDirectly( int iField, OGRGeometry * poGeomIn )
         return OGRERR_FAILURE;
     }
 
-    delete papoGeometries[iField];
-    papoGeometries[iField] = poGeomIn;
+    if( papoGeometries[iField] != poGeomIn )
+    {
+        delete papoGeometries[iField];
+        papoGeometries[iField] = poGeomIn;
+    }
 
     // I should be verifying that the geometry matches the defn's type.
     
@@ -721,12 +724,15 @@ OGRErr OGRFeature::SetGeomField( int iField, OGRGeometry * poGeomIn )
     if( iField < 0 || iField >= GetGeomFieldCount() )
         return OGRERR_FAILURE;
 
-    delete papoGeometries[iField];
+    if( papoGeometries[iField] != poGeomIn )
+    {
+        delete papoGeometries[iField];
 
-    if( poGeomIn != NULL )
-        papoGeometries[iField] = poGeomIn->clone();
-    else
-        papoGeometries[iField] = NULL;
+        if( poGeomIn != NULL )
+            papoGeometries[iField] = poGeomIn->clone();
+        else
+            papoGeometries[iField] = NULL;
+    }
 
     // I should be verifying that the geometry matches the defn's type.
     
diff --git a/ogr/ogrsf_frmts/csv/ogrcsvlayer.cpp b/ogr/ogrsf_frmts/csv/ogrcsvlayer.cpp
index 196d01b..fab0366 100644
--- a/ogr/ogrsf_frmts/csv/ogrcsvlayer.cpp
+++ b/ogr/ogrsf_frmts/csv/ogrcsvlayer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrcsvlayer.cpp 29897 2015-08-29 12:36:40Z rouault $
+ * $Id: ogrcsvlayer.cpp 32442 2015-12-24 19:13:22Z rouault $
  *
  * Project:  CSV Translator
  * Purpose:  Implements OGRCSVLayer class.
@@ -34,7 +34,7 @@
 #include "cpl_csv.h"
 #include "ogr_p.h"
 
-CPL_CVSID("$Id: ogrcsvlayer.cpp 29897 2015-08-29 12:36:40Z rouault $");
+CPL_CVSID("$Id: ogrcsvlayer.cpp 32442 2015-12-24 19:13:22Z rouault $");
 
 
 
@@ -1549,7 +1549,7 @@ OGRErr OGRCSVLayer::CreateGeomField( OGRGeomFieldDefn *poGeomField,
     panGeomFieldIndex[poFeatureDefn->GetFieldCount() - 1] =
         poFeatureDefn->GetGeomFieldCount() - 1;
 
-    return OGRERR_FAILURE;
+    return OGRERR_NONE;
 }
 
 /************************************************************************/
diff --git a/ogr/ogrsf_frmts/generic/ogr_gensql.cpp b/ogr/ogrsf_frmts/generic/ogr_gensql.cpp
index 449d52a..b85a67b 100644
--- a/ogr/ogrsf_frmts/generic/ogr_gensql.cpp
+++ b/ogr/ogrsf_frmts/generic/ogr_gensql.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogr_gensql.cpp 29482 2015-07-06 09:24:54Z rouault $
+ * $Id: ogr_gensql.cpp 31016 2015-10-16 08:11:46Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Implements OGRGenSQLResultsLayer.
@@ -36,7 +36,7 @@
 #include "cpl_time.h"
 #include <vector>
 
-CPL_CVSID("$Id: ogr_gensql.cpp 29482 2015-07-06 09:24:54Z rouault $");
+CPL_CVSID("$Id: ogr_gensql.cpp 31016 2015-10-16 08:11:46Z rouault $");
 
 
 class OGRGenSQLGeomFieldDefn: public OGRGeomFieldDefn
@@ -2063,11 +2063,20 @@ int OGRGenSQLResultsLayer::Compare( OGRField *pasFirstTuple,
             poFDefn = poSrcLayer->GetLayerDefn()->GetFieldDefn( 
                 psKeyDef->field_index );
         
-        if( (pasFirstTuple[iKey].Set.nMarker1 == OGRUnsetMarker 
-             && pasFirstTuple[iKey].Set.nMarker2 == OGRUnsetMarker)
-            || (pasSecondTuple[iKey].Set.nMarker1 == OGRUnsetMarker 
-                && pasSecondTuple[iKey].Set.nMarker2 == OGRUnsetMarker) )
-            nResult = 0;
+        if( pasFirstTuple[iKey].Set.nMarker1 == OGRUnsetMarker 
+             && pasFirstTuple[iKey].Set.nMarker2 == OGRUnsetMarker )
+        {
+            if( pasSecondTuple[iKey].Set.nMarker1 == OGRUnsetMarker 
+                && pasSecondTuple[iKey].Set.nMarker2 == OGRUnsetMarker )
+                nResult = 0;
+            else
+                nResult = -1;
+        }
+        else if ( pasSecondTuple[iKey].Set.nMarker1 == OGRUnsetMarker 
+                && pasSecondTuple[iKey].Set.nMarker2 == OGRUnsetMarker )
+        {
+            nResult = 1;
+        }
         else if ( poFDefn == NULL )
         {
             switch (SpecialFieldTypes[psKeyDef->field_index - iFIDFieldIndex])
diff --git a/ogr/ogrsf_frmts/generic/ogrlayer.cpp b/ogr/ogrsf_frmts/generic/ogrlayer.cpp
index dee21a0..87aa925 100644
--- a/ogr/ogrsf_frmts/generic/ogrlayer.cpp
+++ b/ogr/ogrsf_frmts/generic/ogrlayer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrlayer.cpp 28928 2015-04-17 10:24:19Z rouault $
+ * $Id: ogrlayer.cpp 33074 2016-01-22 09:31:13Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  The generic portions of the OGRSFLayer class.
@@ -35,7 +35,7 @@
 #include "swq.h"
 #include "ograpispy.h"
 
-CPL_CVSID("$Id: ogrlayer.cpp 28928 2015-04-17 10:24:19Z rouault $");
+CPL_CVSID("$Id: ogrlayer.cpp 33074 2016-01-22 09:31:13Z rouault $");
 
 /************************************************************************/
 /*                              OGRLayer()                              */
@@ -1260,7 +1260,7 @@ void OGR_L_SetSpatialFilterRectEx( OGRLayerH hLayer,
 int OGRLayer::InstallFilter( OGRGeometry * poFilter )
 
 {
-    if( m_poFilterGeom == NULL && poFilter == NULL )
+    if( m_poFilterGeom == poFilter )
         return FALSE;
 
 /* -------------------------------------------------------------------- */
@@ -1778,7 +1778,10 @@ OGRErr OGRLayer::SetIgnoredFields( const char **papszFields )
     {
         poDefn->GetFieldDefn(iField)->SetIgnored( FALSE );
     }
-    poDefn->SetGeometryIgnored( FALSE );
+    for( int iField = 0; iField < poDefn->GetGeomFieldCount(); iField++ )
+    {
+        poDefn->GetGeomFieldDefn(iField)->SetIgnored( FALSE );
+    }
     poDefn->SetStyleIgnored( FALSE );
     
     if ( papszFields == NULL )
@@ -3805,6 +3808,15 @@ OGRErr OGRLayer::Erase( OGRLayer *pLayerMethod,
                 delete x_geom_diff;
             delete geom;
         }
+        else
+        {
+            z = new OGRFeature(poDefnResult);
+            z->SetFieldsFrom(x, mapInput);
+            OGRGeometry* x_geom_diff = x_geom->clone();
+            if( bPromoteToMulti )
+                x_geom_diff = promote_to_multi(x_geom_diff);
+            z->SetGeometryDirectly(x_geom_diff);
+        }
         delete x;
         if (z) {
             if (z->GetGeometryRef() != NULL && !z->GetGeometryRef()->IsEmpty())
diff --git a/ogr/ogrsf_frmts/geojson/ogr_geojson.h b/ogr/ogrsf_frmts/geojson/ogr_geojson.h
index b3c0963..d4ed5a0 100644
--- a/ogr/ogrsf_frmts/geojson/ogr_geojson.h
+++ b/ogr/ogrsf_frmts/geojson/ogr_geojson.h
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogr_geojson.h 29111 2015-05-02 18:06:16Z rouault $
+ * $Id: ogr_geojson.h 32121 2015-12-11 10:25:38Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Definitions of OGR OGRGeoJSON driver types.
@@ -37,7 +37,7 @@
 #include <vector> // used by OGRGeoJSONLayer
 #include "ogrgeojsonutils.h"
 
-#define SPACE_FOR_BBOX  80
+#define SPACE_FOR_BBOX  130
 
 class OGRGeoJSONDataSource;
 
diff --git a/ogr/ogrsf_frmts/geojson/ogrgeojsonreader.cpp b/ogr/ogrsf_frmts/geojson/ogrgeojsonreader.cpp
index 1e9fcd5..e2f53a5 100644
--- a/ogr/ogrsf_frmts/geojson/ogrgeojsonreader.cpp
+++ b/ogr/ogrsf_frmts/geojson/ogrgeojsonreader.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrgeojsonreader.cpp 29156 2015-05-05 10:19:17Z rouault $
+ * $Id: ogrgeojsonreader.cpp 31112 2015-10-23 20:28:27Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Implementation of OGRGeoJSONReader class (OGR GeoJSON Driver).
@@ -670,7 +670,7 @@ bool OGRGeoJSONReader::GenerateFeatureDefn( OGRGeoJSONLayer* poLayer, json_objec
 
         bSuccess = true; // SUCCESS
     }
-    else
+    else if( poObj != NULL && json_object_get_type(poObj) == json_type_object )
     {
         json_object_iter it;
         it.key = NULL;
diff --git a/ogr/ogrsf_frmts/geojson/ogrgeojsonwritelayer.cpp b/ogr/ogrsf_frmts/geojson/ogrgeojsonwritelayer.cpp
index f47b713..8405d65 100644
--- a/ogr/ogrsf_frmts/geojson/ogrgeojsonwritelayer.cpp
+++ b/ogr/ogrsf_frmts/geojson/ogrgeojsonwritelayer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrgeojsonwritelayer.cpp 27959 2014-11-14 18:29:21Z rouault $
+ * $Id: ogrgeojsonwritelayer.cpp 32121 2015-12-11 10:25:38Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Implementation of OGRGeoJSONWriteLayer class (OGR GeoJSON Driver).
@@ -67,36 +67,27 @@ OGRGeoJSONWriteLayer::~OGRGeoJSONWriteLayer()
 
     if( bWriteBBOX && sEnvelopeLayer.IsInit() )
     {
-        json_object* poObjBBOX = json_object_new_array();
-        json_object_array_add(poObjBBOX,
-                        json_object_new_double_with_precision(sEnvelopeLayer.MinX, nCoordPrecision));
-        json_object_array_add(poObjBBOX,
-                        json_object_new_double_with_precision(sEnvelopeLayer.MinY, nCoordPrecision));
+        CPLString osBBOX = "[ ";
+        osBBOX += CPLSPrintf("%.15g, ", sEnvelopeLayer.MinX);
+        osBBOX += CPLSPrintf("%.15g, ", sEnvelopeLayer.MinY);
         if( bBBOX3D )
-            json_object_array_add(poObjBBOX,
-                        json_object_new_double_with_precision(sEnvelopeLayer.MinZ, nCoordPrecision));
-        json_object_array_add(poObjBBOX,
-                        json_object_new_double_with_precision(sEnvelopeLayer.MaxX, nCoordPrecision));
-        json_object_array_add(poObjBBOX,
-                        json_object_new_double_with_precision(sEnvelopeLayer.MaxY, nCoordPrecision));
+            osBBOX += CPLSPrintf("%.15g, ", sEnvelopeLayer.MinZ);
+        osBBOX += CPLSPrintf("%.15g, ", sEnvelopeLayer.MaxX);
+        osBBOX += CPLSPrintf("%.15g", sEnvelopeLayer.MaxY);
         if( bBBOX3D )
-            json_object_array_add(poObjBBOX,
-                        json_object_new_double_with_precision(sEnvelopeLayer.MaxZ, nCoordPrecision));
+            osBBOX += CPLSPrintf(", %.15g", sEnvelopeLayer.MaxZ);
+        osBBOX += " ]";
 
-        const char* pszBBOX = json_object_to_json_string( poObjBBOX );
-        if( poDS_->GetFpOutputIsSeekable() )
+        if( poDS_->GetFpOutputIsSeekable() && osBBOX.size() + 9 < SPACE_FOR_BBOX )
         {
             VSIFSeekL(fp, poDS_->GetBBOXInsertLocation(), SEEK_SET);
-            if (strlen(pszBBOX) + 9 < SPACE_FOR_BBOX)
-                VSIFPrintfL( fp, "\"bbox\": %s,", pszBBOX );
+            VSIFPrintfL( fp, "\"bbox\": %s,", osBBOX.c_str() );
             VSIFSeekL(fp, 0, SEEK_END);
         }
         else
         {
-            VSIFPrintfL( fp, ",\n\"bbox\": %s", pszBBOX );
+            VSIFPrintfL( fp, ",\n\"bbox\": %s", osBBOX.c_str() );
         }
-
-        json_object_put( poObjBBOX );
     }
 
     VSIFPrintfL( fp, "\n}\n" );
diff --git a/ogr/ogrsf_frmts/gml/gmlhandler.cpp b/ogr/ogrsf_frmts/gml/gmlhandler.cpp
index 82a0079..c08f481 100644
--- a/ogr/ogrsf_frmts/gml/gmlhandler.cpp
+++ b/ogr/ogrsf_frmts/gml/gmlhandler.cpp
@@ -1,5 +1,5 @@
 /**********************************************************************
- * $Id: gmlhandler.cpp 29217 2015-05-21 09:08:48Z rouault $
+ * $Id: gmlhandler.cpp 31860 2015-11-30 19:23:09Z rouault $
  *
  * Project:  GML Reader
  * Purpose:  Implementation of GMLHandler class.
@@ -1105,6 +1105,13 @@ OGRErr GMLHandler::startElementFeatureAttribute(const char *pszName, int nLenNam
             {
                 m_bAlreadyFoundGeometry = TRUE;
                 bReadGeometry = TRUE;
+                m_nGeometryPropertyIndex = poClass->GetGeometryPropertyIndexBySrcElement( poState->osPath.c_str() );
+                if( m_nGeometryPropertyIndex < 0 )
+                {
+                    poClass->AddGeometryProperty( new GMLGeometryPropertyDefn(
+                            "geometry", poState->osPath.c_str(), wkbUnknown, -1, TRUE ) );
+                    m_nGeometryPropertyIndex = poClass->GetGeometryPropertyCount();
+                }
             }
 
             else
diff --git a/ogr/ogrsf_frmts/gml/ogrgmldatasource.cpp b/ogr/ogrsf_frmts/gml/ogrgmldatasource.cpp
index d8a623c..674fc01 100644
--- a/ogr/ogrsf_frmts/gml/ogrgmldatasource.cpp
+++ b/ogr/ogrsf_frmts/gml/ogrgmldatasource.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrgmldatasource.cpp 29330 2015-06-14 12:11:11Z rouault $
+ * $Id: ogrgmldatasource.cpp 32902 2016-01-10 17:54:15Z rouault $
  *
  * Project:  OGR
  * Purpose:  Implements OGRGMLDataSource class.
@@ -47,7 +47,7 @@
 
 #include <vector>
 
-CPL_CVSID("$Id: ogrgmldatasource.cpp 29330 2015-06-14 12:11:11Z rouault $");
+CPL_CVSID("$Id: ogrgmldatasource.cpp 32902 2016-01-10 17:54:15Z rouault $");
 
 static int ExtractSRSName(const char* pszXML, char* szSRSName,
                           size_t sizeof_szSRSName);
@@ -1338,7 +1338,7 @@ void OGRGMLDataSource::BuildJointClassFromScannedSchema()
             if( osPrefix == aapoGeomProps[iSubClass].first )
                 break;
         }
-        if( iSubClass == (int)aapoProps.size() )
+        if( iSubClass == (int)aapoGeomProps.size() )
             aapoGeomProps.push_back( std::pair< CPLString, std::vector<GMLGeometryPropertyDefn*> >
                     (osPrefix, std::vector<GMLGeometryPropertyDefn*>()) );
         aapoGeomProps[iSubClass].second.push_back(poProp);
diff --git a/ogr/ogrsf_frmts/gpkg/gdalgeopackagerasterband.cpp b/ogr/ogrsf_frmts/gpkg/gdalgeopackagerasterband.cpp
index 7877990..ab6dd32 100644
--- a/ogr/ogrsf_frmts/gpkg/gdalgeopackagerasterband.cpp
+++ b/ogr/ogrsf_frmts/gpkg/gdalgeopackagerasterband.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdalgeopackagerasterband.cpp 28601 2015-03-03 11:06:40Z rouault $
+ * $Id: gdalgeopackagerasterband.cpp 33002 2016-01-15 15:11:34Z rouault $
  *
  * Project:  GeoPackage Translator
  * Purpose:  Implements GDALGeoPackageRasterBand class
@@ -31,7 +31,9 @@
 #include "memdataset.h"
 #include "gdal_alg_priv.h"
 
-//#define DEBUG_VERBOSE
+#if !defined(DEBUG_VERBOSE) && defined(DEBUG_VERBOSE_GPKG)
+#define DEBUG_VERBOSE
+#endif
 
 /************************************************************************/
 /*                      GDALGeoPackageRasterBand()                      */
@@ -421,14 +423,13 @@ CPLErr GDALGeoPackageDataset::ReadTile(const CPLString& osMemFileName,
 
 GByte* GDALGeoPackageDataset::ReadTile(int nRow, int nCol)
 {
-    GByte* pabyData = NULL;
-
     int nBlockXSize, nBlockYSize;
     GetRasterBand(1)->GetBlockSize(&nBlockXSize, &nBlockYSize);
-    if( m_nShiftXPixelsMod )
+    if( m_nShiftXPixelsMod || m_nShiftYPixelsMod )
     {
-        int i;
-        for(i = 0; i < 4; i ++)
+        GByte* pabyData = NULL;
+        int i = 0;
+        for( ; i < 4; i++ )
         {
             if( m_asCachedTilesDesc[i].nRow == nRow &&
                 m_asCachedTilesDesc[i].nCol == nCol )
@@ -436,7 +437,8 @@ GByte* GDALGeoPackageDataset::ReadTile(int nRow, int nCol)
                 if( m_asCachedTilesDesc[i].nIdxWithinTileData >= 0 )
                 {
                     return m_pabyCachedTiles +
-                        m_asCachedTilesDesc[i].nIdxWithinTileData * 4 * nBlockXSize * nBlockYSize;
+                        m_asCachedTilesDesc[i].nIdxWithinTileData * 4 *
+                        nBlockXSize * nBlockYSize;
                 }
                 else
                 {
@@ -459,11 +461,45 @@ GByte* GDALGeoPackageDataset::ReadTile(int nRow, int nCol)
             }
         }
         CPLAssert(i < 4);
+        return ReadTile(nRow, nCol, pabyData);
     }
     else
-        pabyData = m_pabyCachedTiles;
-    
-    return ReadTile(nRow, nCol, pabyData);
+    {
+        GByte* pabyDest = m_pabyCachedTiles + 8 * nBlockXSize * nBlockYSize;
+        int bAllNonDirty = TRUE;
+        for( int i = 0; i < nBands; i++ )
+        {
+            if( m_asCachedTilesDesc[0].abBandDirty[i] )
+                bAllNonDirty = FALSE;
+        }
+        if( bAllNonDirty )
+        {
+            return ReadTile(nRow, nCol, pabyDest);
+        }
+
+        /* If some bands of the blocks are dirty/written we need to fetch */
+        /* the tile in a temporary buffer in order not to override dirty bands*/
+        for( int i = 1; i <= 3; i++ )
+        {
+            m_asCachedTilesDesc[i].nRow = -1;
+            m_asCachedTilesDesc[i].nCol = -1;
+            m_asCachedTilesDesc[i].nIdxWithinTileData = -1;
+        }
+        GByte* pabyTemp = m_pabyCachedTiles + 12 * nBlockXSize * nBlockYSize;
+        if( ReadTile(nRow, nCol, pabyTemp) != NULL )
+        {
+            for( int i = 0; i < nBands; i++ )
+            {
+                if( !m_asCachedTilesDesc[0].abBandDirty[i] )
+                {
+                    memcpy(pabyDest + i * nBlockXSize * nBlockYSize,
+                           pabyTemp + i * nBlockXSize * nBlockYSize,
+                           nBlockXSize * nBlockYSize);
+                }
+            }
+        }
+        return pabyDest;
+    }
 }
 
 /************************************************************************/
@@ -587,21 +623,24 @@ CPLErr GDALGeoPackageRasterBand::IReadBlock(int nBlockXOff, int nBlockYOff,
                                             void* pData)
 {
     GDALGeoPackageDataset* poGDS = (GDALGeoPackageDataset* )poDS;
-    //CPLDebug("GPKG", "IReadBlock(nBand=%d,nBlockXOff=%d,nBlockYOff=%d",
-    //         nBand,nBlockXOff,nBlockYOff);
 
-    int nRowMin = nBlockYOff + poGDS->m_nShiftYTiles;
+#ifdef DEBUG_VERBOSE
+    CPLDebug( "GPKG", "IReadBlock(nBand=%d,nBlockXOff=%d,nBlockYOff=%d,m_nZoomLevel=%d)",
+              nBand,nBlockXOff,nBlockYOff,poGDS->m_nZoomLevel);
+#endif
+
+    const int nRowMin = nBlockYOff + poGDS->m_nShiftYTiles;
     int nRowMax = nRowMin;
     if( poGDS->m_nShiftYPixelsMod )
         nRowMax ++;
-    
-    int nColMin = nBlockXOff + poGDS->m_nShiftXTiles;
+
+    const int nColMin = nBlockXOff + poGDS->m_nShiftXTiles;
     int nColMax = nColMin;
     if( poGDS->m_nShiftXPixelsMod )
         nColMax ++;
 
     /* Optimize for left to right reading at constant row */
-    if( poGDS->m_nShiftXPixelsMod )
+    if( poGDS->m_nShiftXPixelsMod || poGDS->m_nShiftYPixelsMod )
     {
         if( nRowMin == poGDS->m_asCachedTilesDesc[0].nRow &&
             nColMin == poGDS->m_asCachedTilesDesc[0].nCol + 1 &&
@@ -642,6 +681,17 @@ CPLErr GDALGeoPackageRasterBand::IReadBlock(int nBlockXOff, int nBlockYOff,
     {
         for(int nCol = nColMin; nCol <= nColMax; nCol++ )
         {
+            if( poGDS->m_nShiftXPixelsMod == 0 && poGDS->m_nShiftYPixelsMod == 0 )
+            {
+                if( !(nRow == poGDS->m_asCachedTilesDesc[0].nRow &&
+                      nCol == poGDS->m_asCachedTilesDesc[0].nCol &&
+                      poGDS->m_asCachedTilesDesc[0].nIdxWithinTileData == 0) )
+                {
+                    if( poGDS->WriteTile() != CE_None )
+                        return CE_Failure;
+                }
+            }
+
             GByte* pabyTileData = poGDS->ReadTile(nRow, nCol);
             if( pabyTileData == NULL )
                 return CE_Failure;
@@ -669,11 +719,33 @@ CPLErr GDALGeoPackageRasterBand::IReadBlock(int nBlockXOff, int nBlockYOff,
                 }
 
                 // Composite tile data into block data
-                if( poGDS->m_nShiftXPixelsMod == 0 && poGDS->m_nShiftYPixelsMod == 0 )
+                if( poGDS->m_nShiftXPixelsMod == 0
+                    && poGDS->m_nShiftYPixelsMod == 0 )
                 {
-                    memcpy(pabyDest,
-                           pabyTileData + (iBand - 1) * nBlockXSize * nBlockYSize,
-                           nBlockXSize * nBlockYSize);
+                    memcpy( pabyDest,
+                            pabyTileData +
+                            (iBand - 1) * nBlockXSize * nBlockYSize,
+                            nBlockXSize * nBlockYSize );
+#ifdef DEBUG_VERBOSE
+                    if( (nBlockXOff+1) * nBlockXSize <= nRasterXSize &&
+                        (nBlockYOff+1) * nBlockYSize > nRasterYSize )
+                    {
+                        bool bFoundNonZero = false;
+                        for(int y = nRasterYSize - nBlockYOff * nBlockYSize; y < nBlockYSize; y++)
+                        {
+                            for(int x=0;x<nBlockXSize;x++)
+                            {
+                                if( pabyDest[y*nBlockXSize+x] != 0 && !bFoundNonZero )
+                                {
+                                    CPLDebug("GPKG", "IReadBlock(): Found non-zero content in ghost part of tile(nBand=%d,nBlockXOff=%d,nBlockYOff=%d,m_nZoomLevel=%d)\n",
+                                            iBand,nBlockXOff,nBlockYOff,poGDS->m_nZoomLevel);
+                                    bFoundNonZero = true;
+                                }
+                            }
+                        }
+                    }
+#endif
+
                 }
                 else
                 {
@@ -827,6 +899,34 @@ CPLErr GDALGeoPackageDataset::WriteTileInternal()
     if( nXOff >= nRasterXSize || nYOff >= nRasterYSize )
         return CE_None;
 
+#ifdef DEBUG_VERBOSE
+    if( m_nShiftXPixelsMod == 0 && m_nShiftYPixelsMod == 0 )
+    {
+        int nBlockXOff = nCol;
+        int nBlockYOff = nRow;
+        if( (nBlockXOff+1) * nBlockXSize <= nRasterXSize &&
+            (nBlockYOff+1) * nBlockYSize > nRasterYSize )
+        {
+            for(int i = 0; i < nBands; i++ )
+            {
+                bool bFoundNonZero = false;
+                for(int y = nRasterYSize - nBlockYOff * nBlockYSize; y < nBlockYSize; y++)
+                {
+                    for(int x=0;x<nBlockXSize;x++)
+                    {
+                        if( m_pabyCachedTiles[y*nBlockXSize+x + i * nBlockXSize * nBlockYSize] != 0 && !bFoundNonZero )
+                        {
+                            CPLDebug("GPKG", "WriteTileInternal(): Found non-zero content in ghost part of tile(band=%d,nBlockXOff=%d,nBlockYOff=%d,m_nZoomLevel=%d)\n",
+                                    i+1,nBlockXOff,nBlockYOff,m_nZoomLevel);
+                            bFoundNonZero = true;
+                        }
+                    }
+                }
+            }
+        }
+    }
+#endif
+
     /* Validity area of tile data in intra-tile coordinate space */
     int iXOff = 0;
     int iYOff = 0;
@@ -1738,10 +1838,13 @@ CPLErr GDALGeoPackageDataset::WriteShiftedTile(int nRow, int nCol, int nBand,
 CPLErr GDALGeoPackageRasterBand::IWriteBlock(int nBlockXOff, int nBlockYOff,
                                              void* pData)
 {
-    //CPLDebug("GPKG", "IWriteBlock(nBand=%d,nBlockXOff=%d,nBlockYOff=%d",
-    //         nBand,nBlockXOff,nBlockYOff);
-
     GDALGeoPackageDataset* poGDS = (GDALGeoPackageDataset* )poDS;
+
+#ifdef DEBUG_VERBOSE
+    CPLDebug("GPKG", "IWriteBlock(nBand=%d,nBlockXOff=%d,nBlockYOff=%d,m_nZoomLevel=%d)",
+             nBand,nBlockXOff,nBlockYOff,poGDS->m_nZoomLevel);
+#endif
+
     if( !poGDS->bUpdate )
     {
         CPLError(CE_Failure, CPLE_NotSupported,
@@ -1843,8 +1946,62 @@ CPLErr GDALGeoPackageRasterBand::IWriteBlock(int nBlockXOff, int nBlockYOff,
                 // Composite block data into tile data
                 if( poGDS->m_nShiftXPixelsMod == 0 && poGDS->m_nShiftYPixelsMod == 0 )
                 {
+
+#ifdef DEBUG_VERBOSE
+                    if( (nBlockXOff+1) * nBlockXSize <= nRasterXSize &&
+                        (nBlockYOff+1) * nBlockYSize > nRasterYSize )
+                    {
+                        bool bFoundNonZero = false;
+                        for(int y = nRasterYSize - nBlockYOff * nBlockYSize; y < nBlockYSize; y++)
+                        {
+                            for(int x=0;x<nBlockXSize;x++)
+                            {
+                                if( pabySrc[y*nBlockXSize+x] != 0 && !bFoundNonZero )
+                                {
+                                    CPLDebug("GPKG", "IWriteBlock(): Found non-zero content in ghost part of tile(nBand=%d,nBlockXOff=%d,nBlockYOff=%d,m_nZoomLevel=%d)\n",
+                                            iBand,nBlockXOff,nBlockYOff,poGDS->m_nZoomLevel);
+                                    bFoundNonZero = true;
+                                }
+                            }
+                        }
+                    }
+#endif
+
                     memcpy( poGDS->m_pabyCachedTiles + (iBand - 1) * nBlockXSize * nBlockYSize,
                             pabySrc, nBlockXSize * nBlockYSize );
+
+                    // Make sure partial blocks are zero'ed outside of the validity area
+                    // but do that only when know that JPEG will not be used so as to
+                    // avoid edge effects (although we should probably repeat last pixels
+                    // if we really want to do that, but that only makes sense if readers
+                    // only clip to the gpkg_contents extent). Well, ere on the safe side for now
+                    if( poGDS->m_eTF != GPKG_TF_JPEG &&
+                        ((nBlockXOff+1) * nBlockXSize >= nRasterXSize ||
+                         (nBlockYOff+1) * nBlockYSize >= nRasterYSize) )
+                    {
+                        int nXEndValidity = nRasterXSize - nBlockXOff * nBlockXSize;
+                        if( nXEndValidity > nBlockXSize )
+                            nXEndValidity = nBlockXSize;
+                        int nYEndValidity = nRasterYSize - nBlockYOff * nBlockYSize;
+                        if( nYEndValidity > nBlockYSize )
+                            nYEndValidity = nBlockYSize;
+                        if( nXEndValidity < nBlockXSize )
+                        {
+                            for( int iY = 0; iY < nYEndValidity; iY++ )
+                            {
+                                memset( poGDS->m_pabyCachedTiles + ((iBand - 1) * nBlockYSize + iY) * nBlockXSize + nXEndValidity,
+                                        0,
+                                        nBlockXSize - nXEndValidity );
+                            }
+                        }
+                        if( nYEndValidity < nBlockYSize )
+                        {
+                            memset( poGDS->m_pabyCachedTiles + ((iBand - 1) * nBlockYSize + nYEndValidity) * nBlockXSize,
+                                    0,
+                                    (nBlockYSize - nYEndValidity) * nBlockXSize );
+                        }
+                    }
+
                 }
                 else
                 {
diff --git a/ogr/ogrsf_frmts/gpx/ogrgpxlayer.cpp b/ogr/ogrsf_frmts/gpx/ogrgpxlayer.cpp
index 1cc5ecf..58509dc 100644
--- a/ogr/ogrsf_frmts/gpx/ogrgpxlayer.cpp
+++ b/ogr/ogrsf_frmts/gpx/ogrgpxlayer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrgpxlayer.cpp 28900 2015-04-14 09:40:34Z rouault $
+ * $Id: ogrgpxlayer.cpp 31752 2015-11-25 11:02:14Z rouault $
  *
  * Project:  GPX Translator
  * Purpose:  Implements OGRGPXLayer class.
@@ -33,7 +33,7 @@
 #include "cpl_minixml.h"
 #include "ogr_p.h"
 
-CPL_CVSID("$Id: ogrgpxlayer.cpp 28900 2015-04-14 09:40:34Z rouault $");
+CPL_CVSID("$Id: ogrgpxlayer.cpp 31752 2015-11-25 11:02:14Z rouault $");
 
 #define FLD_TRACK_FID       0
 #define FLD_TRACK_SEG_ID    1
@@ -904,7 +904,9 @@ void OGRGPXLayer::endElementCbk(const char *pszName)
             if (poFeature && pszSubElementValue && nSubElementValueLen)
             {
                 pszSubElementValue[nSubElementValueLen] = 0;
-                if (strcmp(pszSubElementName, "time") == 0)
+                if (strcmp(pszSubElementName, "time") == 0 &&
+                    iCurrentField >= 0 &&
+                    poFeature->GetFieldDefnRef(iCurrentField)->GetType() == OFTDateTime )
                 {
                     OGRField sField;
                     if (OGRParseXMLDateTime(pszSubElementValue, &sField))
diff --git a/ogr/ogrsf_frmts/ili/drv_ili.html b/ogr/ogrsf_frmts/ili/drv_ili.html
index c359e75..6eb15b2 100644
--- a/ogr/ogrsf_frmts/ili/drv_ili.html
+++ b/ogr/ogrsf_frmts/ili/drv_ili.html
@@ -58,6 +58,10 @@ or without model:
 <pre>
 ogr2ogr -f "ESRI Shapefile" shpdir RoadsExdm2ien.xml
 </pre>
+Example with curves and multiple geometries:
+<pre>
+ogr2ogr --config OGR_STROKE_CURVE TRUE -SQL 'SELECT Rechtsstatus,publiziertAb,MetadatenGeobasisdaten,Eigentumsbeschraenkung,ZustaendigeStelle,Flaeche FROM "OeREBKRM09trsfr.Transferstruktur.Geometrie"' shpdir ch.bazl.sicherheitszonenplan.oereb_20131118.xtf,OeREBKRM09vs.imd OeREBKRM09trsfr.Transferstruktur.Geometrie
+</pre>
 </li>
 
 <li>
diff --git a/ogr/ogrsf_frmts/ili/ili1reader.cpp b/ogr/ogrsf_frmts/ili/ili1reader.cpp
index dbbd0cf..2d7ede8 100644
--- a/ogr/ogrsf_frmts/ili/ili1reader.cpp
+++ b/ogr/ogrsf_frmts/ili/ili1reader.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ili1reader.cpp 29140 2015-05-03 20:09:32Z pka $
+ * $Id: ili1reader.cpp 33076 2016-01-22 09:45:53Z pka $
  *
  * Project:  Interlis 1 Reader
  * Purpose:  Implementation of ILI1Reader class.
@@ -49,7 +49,7 @@
 #  endif
 #endif
 
-CPL_CVSID("$Id: ili1reader.cpp 29140 2015-05-03 20:09:32Z pka $");
+CPL_CVSID("$Id: ili1reader.cpp 33076 2016-01-22 09:45:53Z pka $");
 
 //
 // ILI1Reader
@@ -399,7 +399,10 @@ void ILI1Reader::ReadGeom(char **stgeom, int geomIdx, OGRwkbGeometryType eType,
         ogrPoint.setX(CPLAtof(tokens[1])); ogrPoint.setY(CPLAtof(tokens[2]));
         if (arc) {
           arc->addPoint(&ogrPoint);
-          ogrCurve->addCurveDirectly(arc);
+          OGRErr error =  ogrCurve->addCurveDirectly(arc);
+          if (error != OGRERR_NONE) {
+            CPLError(CE_Warning, CPLE_AppDefined, "Added geometry: %s", arc->exportToJson() );
+          }
           arc = NULL;
         }
         ogrLine->addPoint(&ogrPoint);
@@ -408,7 +411,10 @@ void ILI1Reader::ReadGeom(char **stgeom, int geomIdx, OGRwkbGeometryType eType,
       {
         //Finish line and start arc
         if (ogrLine->getNumPoints() > 1) {
-          ogrCurve->addCurveDirectly(ogrLine);
+          OGRErr error = ogrCurve->addCurveDirectly(ogrLine);
+          if (error != OGRERR_NONE) {
+            CPLError(CE_Warning, CPLE_AppDefined, "Added geometry: %s", ogrLine->exportToJson() );
+          }
           ogrLine = new OGRLineString();
         } else {
           ogrLine->empty();
@@ -420,17 +426,26 @@ void ILI1Reader::ReadGeom(char **stgeom, int geomIdx, OGRwkbGeometryType eType,
       }
       else if (EQUAL(firsttok, "ELIN"))
       {
-        if (!ogrLine->IsEmpty()) {
-          ogrCurve->addCurveDirectly(ogrLine);
+        if (ogrLine->getNumPoints() > 1) { // Ignore single LIPT after ARCP
+          OGRErr error = ogrCurve->addCurveDirectly(ogrLine);
+          if (error != OGRERR_NONE) {
+            CPLError(CE_Warning, CPLE_AppDefined, "Added geometry: %s", ogrLine->exportToJson() );
+          }
         }
         if (!ogrCurve->IsEmpty()) {
           if (ogrMultiLine)
           {
-            ogrMultiLine->addGeometryDirectly(ogrCurve);
+            OGRErr error = ogrMultiLine->addGeometryDirectly(ogrCurve);
+            if (error != OGRERR_NONE) {
+              CPLError(CE_Warning, CPLE_AppDefined, "Added geometry: %s", ogrCurve->exportToJson() );
+            }
           }
           if (ogrPoly)
           {
-            ogrPoly->addRingDirectly(ogrCurve);
+            OGRErr error = ogrPoly->addRingDirectly(ogrCurve);
+            if (error != OGRERR_NONE) {
+              CPLError(CE_Warning, CPLE_AppDefined, "Added geometry: %s", ogrCurve->exportToJson() );
+            }
           }
         }
         end = TRUE;
diff --git a/ogr/ogrsf_frmts/ili/ogrili1layer.cpp b/ogr/ogrsf_frmts/ili/ogrili1layer.cpp
index 370d316..352dc70 100644
--- a/ogr/ogrsf_frmts/ili/ogrili1layer.cpp
+++ b/ogr/ogrsf_frmts/ili/ogrili1layer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrili1layer.cpp 29221 2015-05-21 13:40:23Z pka $
+ * $Id: ogrili1layer.cpp 33076 2016-01-22 09:45:53Z pka $
  *
  * Project:  Interlis 1 Translator
  * Purpose:  Implements OGRILI1Layer class.
@@ -33,7 +33,7 @@
 #include "cpl_string.h"
 #include "ogr_geos.h"
 
-CPL_CVSID("$Id: ogrili1layer.cpp 29221 2015-05-21 13:40:23Z pka $");
+CPL_CVSID("$Id: ogrili1layer.cpp 33076 2016-01-22 09:45:53Z pka $");
 
 /************************************************************************/
 /*                           OGRILI1Layer()                              */
@@ -460,6 +460,7 @@ void OGRILI1Layer::JoinSurfaceLayer( OGRILI1Layer* poSurfaceLineLayer, int nSurf
 {
     CPLDebug( "OGR_ILI", "Joining surface layer %s with geometries", GetLayerDefn()->GetName());
     OGRwkbGeometryType geomType = GetLayerDefn()->GetGeomFieldDefn(nSurfaceFieldIndex)->GetType();
+    OGRCompoundCurve *surface_lines = 0; // collected lines of SURFACE polygon ring
     poSurfaceLineLayer->ResetReading();
     while (OGRFeature *linefeature = poSurfaceLineLayer->GetNextFeatureRef()) {
         //OBJE entries with same _RefTID are polygon rings of same feature
@@ -469,7 +470,7 @@ void OGRILI1Layer::JoinSurfaceLayer( OGRILI1Layer* poSurfaceLineLayer, int nSurf
         if (feature) {
             OGRCurvePolygon *poly;
             if (feature->GetGeomFieldRef(nSurfaceFieldIndex)) {
-                CPLDebug( "OGR_ILI", "Adding ring to FID " CPL_FRMT_GIB, reftid );
+                CPLDebug( "OGR_ILI", "Appending lines to FID " CPL_FRMT_GIB, reftid );
                 poly = (OGRCurvePolygon *)feature->GetGeomFieldRef(nSurfaceFieldIndex);
             } else {
                 poly = (geomType == wkbPolygon) ? new OGRPolygon() : new OGRCurvePolygon();
@@ -478,10 +479,33 @@ void OGRILI1Layer::JoinSurfaceLayer( OGRILI1Layer* poSurfaceLineLayer, int nSurf
             OGRMultiCurve *lines = (OGRMultiCurve*)linefeature->GetGeomFieldRef(0);
             for( int i = 0; i < lines->getNumGeometries(); i++ ) {
                 OGRCurve *line = (OGRCurve*)lines->getGeometryRef(i);
-                OGRCurve *ring = (geomType == wkbPolygon) ?
-                    OGRCurve::CastToLinearRing((OGRCurve*)line->clone()) :
-                    (OGRCurve*)line->clone();
-                poly->addRingDirectly(ring);
+                OGRCurve *ring = 0;
+                if (surface_lines) {
+                    //SURFACE polygon lines spread over multiple OBJECTs, so we collect curves
+                    OGRCompoundCurve* ccurve = (OGRCompoundCurve*)line;
+                    for (int j=0; j<ccurve->getNumCurves(); j++) {
+                        surface_lines->addCurveDirectly(ccurve->getCurve(j));
+                    }
+                    line = surface_lines;
+                }
+                if (line->get_IsClosed()) {
+                    if (geomType == wkbPolygon) {
+                        ring = OGRCurve::CastToLinearRing((OGRCurve*)line->clone());
+                    } else { // wkbMultiCurve
+                        ring = (OGRCurve*)line->clone();
+                    }
+                }
+                if (ring == 0 && surface_lines == 0) {
+                    //SURFACE polygon lines spread over multiple OBJECTs, so we collect curves
+                    surface_lines = (OGRCompoundCurve*)line->clone();
+                }
+                if (ring) {
+                    OGRErr error = poly->addRingDirectly(ring);
+                    if (error != OGRERR_NONE) {
+                        CPLError(CE_Warning, CPLE_AppDefined, "Added geometry: %s", ring->exportToJson() );
+                    }
+                    surface_lines = 0;
+                }
             }
         } else {
             CPLError(CE_Warning, CPLE_AppDefined, "Couldn't join feature FID " CPL_FRMT_GIB, reftid );
diff --git a/ogr/ogrsf_frmts/mitab/drv_mitab.html b/ogr/ogrsf_frmts/mitab/drv_mitab.html
index 05e81a6..beb66a7 100644
--- a/ogr/ogrsf_frmts/mitab/drv_mitab.html
+++ b/ogr/ogrsf_frmts/mitab/drv_mitab.html
@@ -120,6 +120,11 @@ truncated</li>
 "quick spatial index mode". In this mode writing files can be about 5 times faster, but
 spatial queries can be up to 30 times slower. This can be set to OPTIMIZED in
 GDAL 2.0 to generate optimized spatial index.</li>
+<li><b>BLOCKSIZE=[512,1024,...,32256]</b> (multiples of 512): (GDAL >= 2.0.2)
+Block size for .map files. Defaults to 512.
+GDAL 2.0.1 and earlier versions only supported BLOCKSIZE=512 in reading and writing.
+MapInfo 15.2 and above creates .tab files with a blocksize of 16384 bytes. Any
+MapInfo version should be able to handle block sizes from 512 to 32256.
 </ul>
 
 <h3>Layer Creation Options</h3>
@@ -130,7 +135,7 @@ to increase the accuracy of the coordinates. Note: the geometry of written featu
 must be within the defined box.</li>
 </ul>
 
-<h3>Compatability</h3>
+<h3>Compatibility</h3>
 
 <p>
 Before v1.8.0 , the driver was incorrectly using a "." as the delimiter for id:
diff --git a/ogr/ogrsf_frmts/mitab/mitab.h b/ogr/ogrsf_frmts/mitab/mitab.h
index 73c9a28..2f6052a 100644
--- a/ogr/ogrsf_frmts/mitab/mitab.h
+++ b/ogr/ogrsf_frmts/mitab/mitab.h
@@ -319,9 +319,16 @@ class TABFile: public IMapInfoFile
     virtual TABFileClass GetFileClass() {return TABFC_TABFile;}
 
     virtual int Open(const char *pszFname, const char* pszAccess,
-                     GBool bTestOpenNoError = FALSE ) { return IMapInfoFile::Open(pszFname, pszAccess, bTestOpenNoError); }
+                     GBool bTestOpenNoError = FALSE )
+            { return IMapInfoFile::Open(pszFname, pszAccess, bTestOpenNoError); }
     virtual int Open(const char *pszFname, TABAccess eAccess,
-                     GBool bTestOpenNoError = FALSE );
+                     GBool bTestOpenNoError = FALSE )
+            { return Open(pszFname, eAccess, bTestOpenNoError, 512); }
+
+    virtual int Open(const char *pszFname, TABAccess eAccess,
+                     GBool bTestOpenNoError,
+                     int nBlockSizeForCreate );
+
     virtual int Close();
 
     virtual int SetQuickSpatialIndexMode(GBool bQuickSpatialIndexMode=TRUE);
diff --git a/ogr/ogrsf_frmts/mitab/mitab_feature.cpp b/ogr/ogrsf_frmts/mitab/mitab_feature.cpp
index 7877ce4..77e5d1b 100644
--- a/ogr/ogrsf_frmts/mitab/mitab_feature.cpp
+++ b/ogr/ogrsf_frmts/mitab/mitab_feature.cpp
@@ -8082,7 +8082,7 @@ int TABDebugFeature::ReadGeometryFromMAPFile(TABMAPFile *poMapFile,
     if (m_nSize > 0)
     {
         poObjBlock->GotoByteRel(-5);    // Go back to beginning of header
-        poObjBlock->ReadBytes(m_nSize, m_abyBuf);
+        poObjBlock->ReadBytes(MIN(m_nSize, (int)sizeof(m_abyBuf)), m_abyBuf);
     }
 
     return 0;
diff --git a/ogr/ogrsf_frmts/mitab/mitab_feature_mif.cpp b/ogr/ogrsf_frmts/mitab/mitab_feature_mif.cpp
index c801fc3..b7c564c 100644
--- a/ogr/ogrsf_frmts/mitab/mitab_feature_mif.cpp
+++ b/ogr/ogrsf_frmts/mitab/mitab_feature_mif.cpp
@@ -805,6 +805,11 @@ int TABPolyline::ReadGeometryFromMIFFile(MIDDATAFile *fp)
           case 1:
             bMultiple = FALSE;
             pszLine = fp->GetLine();
+            if( pszLine == NULL )
+            {
+                CSLDestroy(papszToken);
+                return -1;
+            }
             nNumPoints = atoi(pszLine);
             break;
           case 2:
@@ -817,6 +822,11 @@ int TABPolyline::ReadGeometryFromMIFFile(MIDDATAFile *fp)
                 bMultiple = TRUE;
                 nNumSec = atoi(papszToken[2]);
                 pszLine = fp->GetLine();
+                if( pszLine == NULL )
+                {
+                    CSLDestroy(papszToken);
+                    return -1;
+                }
                 nNumPoints = atoi(pszLine);
                 break;
             }
@@ -853,7 +863,16 @@ int TABPolyline::ReadGeometryFromMIFFile(MIDDATAFile *fp)
             {
                 poLine = new OGRLineString();
                 if (j != 0)
-                    nNumPoints = atoi(fp->GetLine());
+                {
+                    pszLine = fp->GetLine();
+                    if( pszLine == NULL )
+                    {
+                        delete poMultiLine;
+                        CSLDestroy(papszToken);
+                        return -1;
+                    }
+                    nNumPoints = atoi(pszLine);
+                }
                 if (nNumPoints < 2)
                 {
                     CPLError(CE_Failure, CPLE_FileIO,
@@ -867,6 +886,13 @@ int TABPolyline::ReadGeometryFromMIFFile(MIDDATAFile *fp)
                     CSLDestroy(papszToken);
                     papszToken = CSLTokenizeString2(fp->GetLine(), 
                                                     " \t", CSLT_HONOURSTRINGS);
+                    if( CSLCount(papszToken) != 2 )
+                    {
+                        CSLDestroy(papszToken);
+                        delete poLine;
+                        delete poMultiLine;
+                        return -1;
+                    }
                     poLine->setPoint(i,fp->GetXTrans(CPLAtof(papszToken[0])),
                                      fp->GetYTrans(CPLAtof(papszToken[1])));
                 }
@@ -1117,10 +1143,13 @@ int TABRegion::ReadGeometryFromMIFFile(MIDDATAFile *fp)
     if (tabPolygons)
         delete[] tabPolygons;
 
-    SetGeometryDirectly(poGeometry);
-    poGeometry->getEnvelope(&sEnvelope);
-    
-    SetMBR(sEnvelope.MinX, sEnvelope.MinY, sEnvelope.MaxX, sEnvelope.MaxY);
+    if( poGeometry )
+    {
+        SetGeometryDirectly(poGeometry);
+        poGeometry->getEnvelope(&sEnvelope);
+        
+        SetMBR(sEnvelope.MinX, sEnvelope.MinY, sEnvelope.MaxX, sEnvelope.MaxY);
+    }
 
     while (((pszLine = fp->GetLine()) != NULL) && 
            fp->IsValidFeature(pszLine) == FALSE)
@@ -1302,8 +1331,8 @@ int TABRectangle::ReadGeometryFromMIFFile(MIDDATAFile *fp)
             CSLDestroy(papszToken);
             papszToken = CSLTokenizeString2(fp->GetLine(), 
                                             " \t", CSLT_HONOURSTRINGS);
-            if (CSLCount(papszToken) !=1 )
-              m_dRoundXRadius = m_dRoundYRadius = CPLAtof(papszToken[1])/2.0;
+            if (CSLCount(papszToken) ==1 )
+              m_dRoundXRadius = m_dRoundYRadius = CPLAtof(papszToken[0])/2.0;
         }
     }
     CSLDestroy(papszToken);
diff --git a/ogr/ogrsf_frmts/mitab/mitab_indfile.cpp b/ogr/ogrsf_frmts/mitab/mitab_indfile.cpp
index 8ec0a96..9e2934e 100644
--- a/ogr/ogrsf_frmts/mitab/mitab_indfile.cpp
+++ b/ogr/ogrsf_frmts/mitab/mitab_indfile.cpp
@@ -103,6 +103,7 @@ TABINDFile::TABINDFile()
     m_papoIndexRootNodes = NULL;
     m_papbyKeyBuffers = NULL;
     m_oBlockManager.SetName("IND");
+    m_oBlockManager.SetBlockSize(512);
 }
 
 /**********************************************************************
diff --git a/ogr/ogrsf_frmts/mitab/mitab_mapcoordblock.cpp b/ogr/ogrsf_frmts/mitab/mitab_mapcoordblock.cpp
index b4a36e8..e6b0695 100644
--- a/ogr/ogrsf_frmts/mitab/mitab_mapcoordblock.cpp
+++ b/ogr/ogrsf_frmts/mitab/mitab_mapcoordblock.cpp
@@ -233,6 +233,7 @@ int     TABMAPCoordBlock::CommitToFile()
     GotoByteInBlock(0x000);
 
     WriteInt16(TABMAP_COORD_BLOCK);    // Block type code
+    CPLAssert(m_nSizeUsed >= MAP_COORD_HEADER_SIZE && m_nSizeUsed < MAP_COORD_HEADER_SIZE + 32768);
     WriteInt16((GInt16)(m_nSizeUsed - MAP_COORD_HEADER_SIZE)); // num. bytes used
     WriteInt32(m_nNextCoordBlock);
 
diff --git a/ogr/ogrsf_frmts/mitab/mitab_mapfile.cpp b/ogr/ogrsf_frmts/mitab/mitab_mapfile.cpp
index 958aa0a..db945c1 100644
--- a/ogr/ogrsf_frmts/mitab/mitab_mapfile.cpp
+++ b/ogr/ogrsf_frmts/mitab/mitab_mapfile.cpp
@@ -247,12 +247,13 @@ TABMAPFile::~TABMAPFile()
  * Return 0 on success, -1 in case of failure.
  **********************************************************************/
 
-int TABMAPFile::Open(const char *pszFname, const char* pszAccess, GBool bNoErrorMsg)
+int TABMAPFile::Open(const char *pszFname, const char* pszAccess, GBool bNoErrorMsg,
+                     int nBlockSizeForCreate)
 {
     if( EQUALN(pszAccess, "r", 1) )
-        return Open(pszFname, TABRead, bNoErrorMsg);
+        return Open(pszFname, TABRead, bNoErrorMsg, nBlockSizeForCreate);
     else if( EQUALN(pszAccess, "w", 1) )
-        return Open(pszFname, TABWrite, bNoErrorMsg);
+        return Open(pszFname, TABWrite, bNoErrorMsg, nBlockSizeForCreate);
     else
     {
         CPLError(CE_Failure, CPLE_FileIO,
@@ -277,7 +278,8 @@ int TABMAPFile::Open(const char *pszFname, const char* pszAccess, GBool bNoError
  * Returns 0 on success, 1 when the .map file does not exist, -1 on error.
  **********************************************************************/
 int TABMAPFile::Open(const char *pszFname, TABAccess eAccess,
-                     GBool bNoErrorMsg /* = FALSE */)
+                     GBool bNoErrorMsg /* = FALSE */,
+                     int nBlockSizeForCreate /* = 512 */)
 {
     VSILFILE    *fp=NULL;
     TABRawBinBlock *poBlock=NULL;
@@ -300,6 +302,16 @@ int TABMAPFile::Open(const char *pszFname, TABAccess eAccess,
     m_bLastOpWasRead = FALSE;
     m_bLastOpWasWrite = FALSE;
 
+    if( m_eAccessMode == TABWrite &&
+            (nBlockSizeForCreate < TAB_MIN_BLOCK_SIZE ||
+             nBlockSizeForCreate > TAB_MAX_BLOCK_SIZE ||
+             (nBlockSizeForCreate % TAB_MIN_BLOCK_SIZE) != 0) )
+    {
+        CPLError(CE_Failure, CPLE_NotSupported,
+                 "Open() failed: invalid block size: %d", nBlockSizeForCreate);
+        return -1;
+    }
+
     /*-----------------------------------------------------------------
      * Open file
      *----------------------------------------------------------------*/
@@ -338,6 +350,7 @@ int TABMAPFile::Open(const char *pszFname, TABAccess eAccess,
                      pszFname);
             return -1;
         }
+        m_oBlockManager.SetBlockSize(((TABMAPHeaderBlock*)poBlock)->m_nRegularBlockSize);
     }
     else if (fp != NULL && m_eAccessMode == TABWrite)
     {
@@ -346,12 +359,15 @@ int TABMAPFile::Open(const char *pszFname, TABAccess eAccess,
          * .MAP files of Version 500 and up appear to have a 1024 bytes
          * header.  The last 512 bytes are usually all zeros.
          *----------------------------------------------------------------*/
-        poBlock = new TABMAPHeaderBlock(m_eAccessMode);
-        poBlock->InitNewBlock(fp, 1024, m_oBlockManager.AllocNewBlock("HEADER") );
+        m_poHeader = new TABMAPHeaderBlock(m_eAccessMode);
+        poBlock = m_poHeader;
+        poBlock->InitNewBlock(fp, nBlockSizeForCreate, 0 );
 
-        // Alloc a second 512 bytes of space since oBlockManager deals 
-        // with 512 bytes blocks.
-        m_oBlockManager.AllocNewBlock("HEADER"); 
+        m_oBlockManager.SetBlockSize(m_poHeader->m_nRegularBlockSize);
+        if( m_poHeader->m_nRegularBlockSize == 512 )
+            m_oBlockManager.SetLastPtr( 512 );
+        else
+            m_oBlockManager.SetLastPtr( 0 );
 
         m_bUpdated = TRUE;
     }
@@ -401,7 +417,7 @@ int TABMAPFile::Open(const char *pszFname, TABAccess eAccess,
         (m_eAccessMode == TABReadWrite && m_poHeader->m_nFirstIndexBlock != 0 ))
     {
         m_poCurObjBlock = new TABMAPObjectBlock(m_eAccessMode);
-        m_poCurObjBlock->InitNewBlock(m_fp, 512);
+        m_poCurObjBlock->InitNewBlock(m_fp, m_poHeader->m_nRegularBlockSize);
     }
     else
     {
@@ -486,7 +502,7 @@ int TABMAPFile::Open(const char *pszFname, TABAccess eAccess,
     {
         VSIStatBufL sStatBuf;
         VSIStatL(m_pszFname, &sStatBuf);
-        m_oBlockManager.SetLastPtr((int)(((sStatBuf.st_size-1)/512)*512));
+        m_oBlockManager.SetLastPtr((int)(((sStatBuf.st_size-1)/m_poHeader->m_nRegularBlockSize)*m_poHeader->m_nRegularBlockSize));
 
         /* Read chain of garbage blocks */
         if( m_poHeader->m_nFirstGarbageBlock != 0 )
@@ -1507,7 +1523,7 @@ int   TABMAPFile::PrepareNewObjViaSpatialIndex(TABMAPObjHdr *poObjHdr)
         // Spatial Index not created yet...
         m_poSpIndex = new TABMAPIndexBlock(m_eAccessMode);
 
-        m_poSpIndex->InitNewBlock(m_fp, 512, 
+        m_poSpIndex->InitNewBlock(m_fp, m_poHeader->m_nRegularBlockSize, 
                                   m_oBlockManager.AllocNewBlock("INDEX"));
         m_poSpIndex->SetMAPBlockManagerRef(&m_oBlockManager);
 
@@ -1567,7 +1583,7 @@ int   TABMAPFile::PrepareNewObjViaSpatialIndex(TABMAPObjHdr *poObjHdr)
 
         int nBlockOffset = m_oBlockManager.AllocNewBlock("OBJECT");
 
-        m_poCurObjBlock->InitNewBlock(m_fp, 512, nBlockOffset);
+        m_poCurObjBlock->InitNewBlock(m_fp, m_poHeader->m_nRegularBlockSize, nBlockOffset);
 
         /*-------------------------------------------------------------
          * Insert new object block in index, based on MBR of poObjHdr
@@ -1658,12 +1674,12 @@ int   TABMAPFile::PrepareNewObjViaSpatialIndex(TABMAPObjHdr *poObjHdr)
         }
 
         /* Check that there's really some place that can be recovered */
-        if( nObjectSpace < 512 - 20 - m_poCurObjBlock->GetNumUnusedBytes() )
+        if( nObjectSpace < m_poHeader->m_nRegularBlockSize - 20 - m_poCurObjBlock->GetNumUnusedBytes() )
         {
 #ifdef DEBUG_VERBOSE
             CPLDebug("MITAB", "Compacting block at offset %d, %d objects valid, recovering %d bytes",
                      m_poCurObjBlock->GetStartAddress(), numSrcObj,
-                     (512 - 20 - m_poCurObjBlock->GetNumUnusedBytes()) - nObjectSpace);
+                     (m_poHeader->m_nRegularBlockSize - 20 - m_poCurObjBlock->GetNumUnusedBytes()) - nObjectSpace);
 #endif
             m_poCurObjBlock->ClearObjects();
 
@@ -1808,7 +1824,7 @@ int   TABMAPFile::PrepareNewObjViaObjBlock(TABMAPObjHdr *poObjHdr)
 
         int nBlockOffset = m_oBlockManager.AllocNewBlock("OBJECT");
 
-        m_poCurObjBlock->InitNewBlock(m_fp, 512, nBlockOffset);
+        m_poCurObjBlock->InitNewBlock(m_fp, m_poHeader->m_nRegularBlockSize, nBlockOffset);
 
         // The reference to the first object block should 
         // actually go through the index blocks... this will be 
@@ -1830,7 +1846,7 @@ int   TABMAPFile::PrepareNewObjViaObjBlock(TABMAPObjHdr *poObjHdr)
          *------------------------------------------------------------*/
         CommitObjAndCoordBlocks(FALSE);
 
-        if (m_poCurObjBlock->InitNewBlock(m_fp,512,
+        if (m_poCurObjBlock->InitNewBlock(m_fp,m_poHeader->m_nRegularBlockSize,
                                   m_oBlockManager.AllocNewBlock("OBJECT"))!=0)
             return -1; /* Error already reported */
 
@@ -1924,7 +1940,7 @@ int TABMAPFile::CommitObjAndCoordBlocks(GBool bDeleteObjects /*=FALSE*/)
     {
         // Update the m_nMaxCoordBufSize member in the header block
         //
-        int nTotalCoordSize = m_poCurCoordBlock->GetNumBlocksInChain()*512;
+        int nTotalCoordSize = m_poCurCoordBlock->GetNumBlocksInChain()*m_poHeader->m_nRegularBlockSize;
         if (nTotalCoordSize > m_poHeader->m_nMaxCoordBufSize)
             m_poHeader->m_nMaxCoordBufSize = nTotalCoordSize;
 
@@ -1967,7 +1983,7 @@ int TABMAPFile::CommitObjAndCoordBlocks(GBool bDeleteObjects /*=FALSE*/)
             // Spatial Index not created yet...
             m_poSpIndex = new TABMAPIndexBlock(m_eAccessMode);
 
-            m_poSpIndex->InitNewBlock(m_fp, 512, 
+            m_poSpIndex->InitNewBlock(m_fp, m_poHeader->m_nRegularBlockSize, 
                                       m_oBlockManager.AllocNewBlock("INDEX"));
             m_poSpIndex->SetMAPBlockManagerRef(&m_oBlockManager);
 
@@ -2024,7 +2040,7 @@ int TABMAPFile::LoadObjAndCoordBlocks(GInt32 nBlockPtr)
      *----------------------------------------------------------------*/
     poBlock = TABCreateMAPBlockFromFile(m_fp, 
                                              nBlockPtr,
-                                             512, TRUE, TABReadWrite);
+                                             m_poHeader->m_nRegularBlockSize, TRUE, TABReadWrite);;
     if (poBlock != NULL &&
         poBlock->GetBlockClass() == TABMAP_OBJECT_BLOCK)
     {
@@ -2050,7 +2066,7 @@ int TABMAPFile::LoadObjAndCoordBlocks(GInt32 nBlockPtr)
 
     poBlock = TABCreateMAPBlockFromFile(m_fp, 
                                    m_poCurObjBlock->GetLastCoordBlockAddress(),
-                                                  512, TRUE, TABReadWrite);
+                                   m_poHeader->m_nRegularBlockSize, TRUE, TABReadWrite);
     if (poBlock != NULL && poBlock->GetBlockClass() == TABMAP_COORD_BLOCK)
     {
         m_poCurCoordBlock = (TABMAPCoordBlock*)poBlock;
@@ -2113,7 +2129,7 @@ TABMAPObjectBlock *TABMAPFile::SplitObjBlock(TABMAPObjHdr *poObjHdrToAdd,
      *----------------------------------------------------------------*/
     GInt32 nFirstSrcCoordBlock = m_poCurObjBlock->GetFirstCoordBlockAddress();
 
-    m_poCurObjBlock->InitNewBlock(m_fp, 512, 
+    m_poCurObjBlock->InitNewBlock(m_fp, m_poHeader->m_nRegularBlockSize, 
                                   m_poCurObjBlock->GetStartAddress());
 
     TABMAPCoordBlock *poSrcCoordBlock = m_poCurCoordBlock;
@@ -2123,7 +2139,7 @@ TABMAPObjectBlock *TABMAPFile::SplitObjBlock(TABMAPObjHdr *poObjHdrToAdd,
      * Create new obj and coord block
      *----------------------------------------------------------------*/
     TABMAPObjectBlock *poNewObjBlock = new TABMAPObjectBlock(m_eAccessMode);
-    poNewObjBlock->InitNewBlock(m_fp, 512, m_oBlockManager.AllocNewBlock("OBJECT"));
+    poNewObjBlock->InitNewBlock(m_fp, m_poHeader->m_nRegularBlockSize, m_oBlockManager.AllocNewBlock("OBJECT"));
 
     /* Use existing center of other block in case we have compressed objects
        and freeze it */
@@ -2417,7 +2433,7 @@ int TABMAPFile::PrepareCoordBlock(int nObjType,
             *ppoCoordBlock = new TABMAPCoordBlock(m_eAccessMode==TABWrite?
                                                   TABReadWrite: 
                                                   m_eAccessMode);
-            (*ppoCoordBlock)->InitNewBlock(m_fp, 512, 
+            (*ppoCoordBlock)->InitNewBlock(m_fp, m_poHeader->m_nRegularBlockSize, 
                                            m_oBlockManager.AllocNewBlock("COORD"));
             (*ppoCoordBlock)->SetMAPBlockManagerRef(&m_oBlockManager);
 
@@ -2430,7 +2446,7 @@ int TABMAPFile::PrepareCoordBlock(int nObjType,
         {
             TABRawBinBlock* poBlock = TABCreateMAPBlockFromFile(m_fp, 
                                     poObjBlock->GetLastCoordBlockAddress(),
-                                    512, TRUE, TABReadWrite);
+                                    m_poHeader->m_nRegularBlockSize, TRUE, TABReadWrite);
             if (poBlock != NULL && poBlock->GetBlockClass() == TABMAP_COORD_BLOCK)
             {
                 delete *ppoCoordBlock;
@@ -2452,7 +2468,7 @@ int TABMAPFile::PrepareCoordBlock(int nObjType,
             int nNewBlockOffset = m_oBlockManager.AllocNewBlock("COORD");
             (*ppoCoordBlock)->SetNextCoordBlock(nNewBlockOffset);
             (*ppoCoordBlock)->CommitToFile();
-            (*ppoCoordBlock)->InitNewBlock(m_fp, 512, nNewBlockOffset);
+            (*ppoCoordBlock)->InitNewBlock(m_fp, m_poHeader->m_nRegularBlockSize, nNewBlockOffset);
             poObjBlock->AddCoordBlockRef((*ppoCoordBlock)->GetStartAddress());
         }
 
@@ -2541,7 +2557,7 @@ TABMAPCoordBlock *TABMAPFile::GetCoordBlock(int nFileOffset)
     if (m_poCurCoordBlock == NULL)
     {
         m_poCurCoordBlock = new TABMAPCoordBlock(m_eAccessMode);
-        m_poCurCoordBlock->InitNewBlock(m_fp, 512);
+        m_poCurCoordBlock->InitNewBlock(m_fp, m_poHeader->m_nRegularBlockSize);
         m_poCurCoordBlock->SetMAPBlockManagerRef(&m_oBlockManager);
     }
 
@@ -2558,7 +2574,7 @@ TABMAPCoordBlock *TABMAPFile::GetCoordBlock(int nFileOffset)
         return NULL;
     }
 
-    if (nFileOffset % 512 == 0)
+    if (nFileOffset % m_poHeader->m_nRegularBlockSize == 0)
         m_poCurCoordBlock->GotoByteInBlock(8);      // Skip Header
 
     return m_poCurCoordBlock;
@@ -2614,21 +2630,23 @@ TABRawBinBlock *TABMAPFile::GetIndexObjectBlock( int nFileOffset )
     /*----------------------------------------------------------------
      * Read from the file
      *---------------------------------------------------------------*/
-    GByte abyData[512];
+    GByte* pabyData = (GByte*) CPLMalloc(m_poHeader->m_nRegularBlockSize);
 
     if (VSIFSeekL(m_fp, nFileOffset, SEEK_SET) != 0 
-        || VSIFReadL(abyData, sizeof(GByte), 512, m_fp) != 512 )
+        || (int)VSIFReadL(pabyData, sizeof(GByte), m_poHeader->m_nRegularBlockSize, m_fp) !=
+                        m_poHeader->m_nRegularBlockSize )
     {
         CPLError(CE_Failure, CPLE_FileIO,
                  "GetIndexBlock() failed reading %d bytes at offset %d.",
-                 512, nFileOffset);
+                 m_poHeader->m_nRegularBlockSize, nFileOffset);
+        CPLFree(pabyData);
         return NULL;
     }
 
 /* -------------------------------------------------------------------- */
 /*      Create and initialize depending on the block type.              */
 /* -------------------------------------------------------------------- */
-    int nBlockType = abyData[0];
+    int nBlockType = pabyData[0];
     TABRawBinBlock *poBlock;
 
     if( nBlockType == TABMAP_INDEX_BLOCK )
@@ -2640,12 +2658,10 @@ TABRawBinBlock *TABMAPFile::GetIndexObjectBlock( int nFileOffset )
     else
         poBlock = new TABMAPObjectBlock(m_eAccessMode);
     
-    if( poBlock->InitBlockFromData(abyData, 512, 512,
-                                   TRUE, m_fp, nFileOffset) == -1 )
-    {
-        delete poBlock;
-        poBlock = NULL;
-    }
+    poBlock->InitBlockFromData(pabyData,
+                                   m_poHeader->m_nRegularBlockSize,
+                                   m_poHeader->m_nRegularBlockSize,
+                                   FALSE, m_fp, nFileOffset);
 
     return poBlock;
 }
@@ -2686,7 +2702,7 @@ int TABMAPFile::InitDrawingTools()
         TABMAPToolBlock *poBlock;
 
         poBlock = new TABMAPToolBlock(TABRead);
-        poBlock->InitNewBlock(m_fp, 512);
+        poBlock->InitNewBlock(m_fp, m_poHeader->m_nRegularBlockSize);
     
         /*-------------------------------------------------------------
          * Use GotoByteInFile() to go to the first block's location.  This will
@@ -2747,9 +2763,9 @@ int TABMAPFile::CommitDrawingTools()
     
     poBlock = new TABMAPToolBlock(m_eAccessMode);
     if( m_poHeader->m_nFirstToolBlock != 0 )
-        poBlock->InitNewBlock(m_fp, 512, m_poHeader->m_nFirstToolBlock);
+        poBlock->InitNewBlock(m_fp, m_poHeader->m_nRegularBlockSize, m_poHeader->m_nFirstToolBlock);
     else
-        poBlock->InitNewBlock(m_fp, 512, m_oBlockManager.AllocNewBlock("TOOL"));
+        poBlock->InitNewBlock(m_fp, m_poHeader->m_nRegularBlockSize, m_oBlockManager.AllocNewBlock("TOOL"));
     poBlock->SetMAPBlockManagerRef(&m_oBlockManager);
 
     m_poHeader->m_nFirstToolBlock = poBlock->GetStartAddress();
diff --git a/ogr/ogrsf_frmts/mitab/mitab_mapheaderblock.cpp b/ogr/ogrsf_frmts/mitab/mitab_mapheaderblock.cpp
index 0313ef1..32cb905 100644
--- a/ogr/ogrsf_frmts/mitab/mitab_mapheaderblock.cpp
+++ b/ogr/ogrsf_frmts/mitab/mitab_mapheaderblock.cpp
@@ -150,7 +150,6 @@ inline double round(double r) {
  *--------------------------------------------------------------------*/
 #define HDR_MAGIC_COOKIE        42424242
 #define HDR_VERSION_NUMBER      500
-#define HDR_DATA_BLOCK_SIZE     512
 
 #define HDR_DEF_ORG_QUADRANT    1       // N-E Quadrant
 #define HDR_DEF_REFLECTXAXIS    0
@@ -213,7 +212,7 @@ void TABMAPHeaderBlock::InitMembersWithDefaultValues()
      * Set acceptable default values for member vars.
      *----------------------------------------------------------------*/
     m_nMAPVersionNumber = HDR_VERSION_NUMBER;
-    m_nBlockSize = HDR_DATA_BLOCK_SIZE;
+    m_nRegularBlockSize = TAB_MIN_BLOCK_SIZE;
 
     m_dCoordsys2DistUnits = 1.0;
     m_nXMin = -1000000000;
@@ -327,7 +326,15 @@ int     TABMAPHeaderBlock::InitBlockFromData(GByte *pabyBuf,
      *----------------------------------------------------------------*/
     GotoByteInBlock(0x104);
     m_nMAPVersionNumber = ReadInt16();
-    m_nBlockSize = ReadInt16();
+    m_nRegularBlockSize = ReadInt16();
+    if( m_nRegularBlockSize < TAB_MIN_BLOCK_SIZE )
+    {
+        CPLError(CE_Failure, CPLE_FileIO,
+              "ReadFromFile(): Invalid block size %d", m_nRegularBlockSize);
+        CPLFree(m_pabyBuf);
+        m_pabyBuf = NULL;
+        return -1;
+    }
 
     m_dCoordsys2DistUnits = ReadDouble();
     m_nXMin = ReadInt32();
@@ -412,10 +419,10 @@ int     TABMAPHeaderBlock::InitBlockFromData(GByte *pabyBuf,
     }
 
     m_sProj.nAffineFlag = 0;
-    if (m_nMAPVersionNumber >= 500 && m_nSizeUsed > 512)
+    if (m_nMAPVersionNumber >= 500 && m_nSizeUsed > TAB_MIN_BLOCK_SIZE)
     {
         // Read Affine parameters A,B,C,D,E,F 
-        // only if version 500+ and block is larger than 512 bytes
+        // only if version 500+ and block is larger than TAB_MIN_BLOCK_SIZE bytes
         int nInUse = ReadByte();
         if (nInUse)
         {
@@ -821,7 +828,7 @@ int     TABMAPHeaderBlock::CommitToFile()
 {
     int i, nStatus = 0;
 
-    if ( m_pabyBuf == NULL || m_nBlockSize != HDR_DATA_BLOCK_SIZE )
+    if ( m_pabyBuf == NULL || m_nRegularBlockSize == 0 )
     {
         CPLError(CE_Failure, CPLE_AssertionFailed, 
         "TABRawBinBlock::CommitToFile(): Block has not been initialized yet!");
@@ -852,7 +859,7 @@ int     TABMAPHeaderBlock::CommitToFile()
 
     WriteInt16(m_nMAPVersionNumber);
 
-    WriteInt16(HDR_DATA_BLOCK_SIZE);
+    WriteInt16(m_nRegularBlockSize);
 
     WriteDouble(m_dCoordsys2DistUnits);
     WriteInt32(m_nXMin);
@@ -960,7 +967,10 @@ int     TABMAPHeaderBlock::InitNewBlock(VSILFILE *fpSrc, int nBlockSize,
     /*-----------------------------------------------------------------
      * Start with the default initialisation
      *----------------------------------------------------------------*/
-    if ( TABRawBinBlock::InitNewBlock(fpSrc, nBlockSize, nFileOffset) != 0)
+
+    /* .MAP files of Version 500 and up appear to have a 1024 bytes
+     * header.  The last 512 bytes are usually all zeros. */
+    if ( TABRawBinBlock::InitNewBlock(fpSrc, 1024, nFileOffset) != 0)
         return -1;
 
     /*-----------------------------------------------------------------
@@ -968,6 +978,8 @@ int     TABMAPHeaderBlock::InitNewBlock(VSILFILE *fpSrc, int nBlockSize,
      *----------------------------------------------------------------*/
     InitMembersWithDefaultValues();
 
+    m_nRegularBlockSize = nBlockSize;
+
     /*-----------------------------------------------------------------
      * And Set the map object length array in the buffer...
      *----------------------------------------------------------------*/
@@ -1018,7 +1030,7 @@ void TABMAPHeaderBlock::Dump(FILE *fpOut /*=NULL*/)
     else
     {
         fprintf(fpOut,"Version %d header block.\n", m_nMAPVersionNumber);
-        fprintf(fpOut,"  m_nBlockSize          = %d\n", m_nBlockSize);
+        fprintf(fpOut,"  m_nRegularBlockSize       = %d\n", m_nRegularBlockSize);
         fprintf(fpOut,"  m_nFirstIndexBlock    = %d\n", m_nFirstIndexBlock);
         fprintf(fpOut,"  m_nFirstGarbageBlock  = %d\n", m_nFirstGarbageBlock);
         fprintf(fpOut,"  m_nFirstToolBlock     = %d\n", m_nFirstToolBlock);
diff --git a/ogr/ogrsf_frmts/mitab/mitab_mapindexblock.cpp b/ogr/ogrsf_frmts/mitab/mitab_mapindexblock.cpp
index 62bc0ab..e71a801 100644
--- a/ogr/ogrsf_frmts/mitab/mitab_mapindexblock.cpp
+++ b/ogr/ogrsf_frmts/mitab/mitab_mapindexblock.cpp
@@ -355,7 +355,7 @@ int     TABMAPIndexBlock::ReadNextEntry(TABMAPIndexEntry *psEntry)
  **********************************************************************/
 int     TABMAPIndexBlock::ReadAllEntries()
 {
-    CPLAssert(m_numEntries <= TAB_MAX_ENTRIES_INDEX_BLOCK);
+    CPLAssert(m_numEntries <= GetMaxEntries());
     if (m_numEntries == 0)
         return 0;
     
@@ -405,9 +405,7 @@ int     TABMAPIndexBlock::WriteNextEntry(TABMAPIndexEntry *psEntry)
  **********************************************************************/
 int     TABMAPIndexBlock::GetNumFreeEntries()
 {
-    /* nMaxEntries = (m_nBlockSize-4)/20;*/
-
-    return (TAB_MAX_ENTRIES_INDEX_BLOCK - m_numEntries);
+    return ((m_nBlockSize-4)/20 - m_numEntries);
 }
 
 /**********************************************************************
@@ -499,7 +497,7 @@ int     TABMAPIndexBlock::InsertEntry(GInt32 nXMin, GInt32 nYMin,
      * Update count of entries and store new entry.
      *----------------------------------------------------------------*/
     m_numEntries++;
-    CPLAssert(m_numEntries <= TAB_MAX_ENTRIES_INDEX_BLOCK);
+    CPLAssert(m_numEntries <= GetMaxEntries());
 
     m_asEntries[m_numEntries-1].XMin = nXMin;
     m_asEntries[m_numEntries-1].YMin = nYMin;
@@ -648,7 +646,7 @@ GInt32  TABMAPIndexBlock::ChooseLeafForInsert(GInt32 nXMin, GInt32 nYMin,
 
     poBlock = TABCreateMAPBlockFromFile(m_fp, 
                                     m_asEntries[nBestCandidate].nBlockPtr,
-                                    512, TRUE, TABReadWrite);
+                                    m_nBlockSize, TRUE, TABReadWrite);
     if (poBlock != NULL && poBlock->GetBlockClass() == TABMAP_INDEX_BLOCK)
     {
         m_poCurChild = (TABMAPIndexBlock*)poBlock;
@@ -855,7 +853,7 @@ int     TABMAPIndexBlock::AddEntry(GInt32 nXMin, GInt32 nYMin,
 
             poBlock = TABCreateMAPBlockFromFile(m_fp, 
                                        m_asEntries[nBestCandidate].nBlockPtr,
-                                       512, TRUE, TABReadWrite);
+                                       m_nBlockSize, TRUE, TABReadWrite);
             if (poBlock != NULL && poBlock->GetBlockClass() == TABMAP_INDEX_BLOCK)
             {
                 m_poCurChild = (TABMAPIndexBlock*)poBlock;
@@ -1167,7 +1165,7 @@ int     TABMAPIndexBlock::SplitNode(GInt32 nNewEntryXMin, GInt32 nNewEntryYMin,
      * Create a 2nd node
      *----------------------------------------------------------------*/
     TABMAPIndexBlock *poNewNode = new TABMAPIndexBlock(m_eAccess);
-    if (poNewNode->InitNewBlock(m_fp, 512, 
+    if (poNewNode->InitNewBlock(m_fp, m_nBlockSize, 
                                 m_poBlockManagerRef->AllocNewBlock("INDEX")) != 0)
     {
         return -1;
@@ -1246,7 +1244,7 @@ int     TABMAPIndexBlock::SplitNode(GInt32 nNewEntryXMin, GInt32 nNewEntryYMin,
             continue;
 
         }
-        else if (m_numEntries >= TAB_MAX_ENTRIES_INDEX_BLOCK-1)
+        else if (m_numEntries >= GetMaxEntries()-1)
         {
             poNewNode->InsertEntry(pasSrcEntries[iEntry].XMin, 
                                    pasSrcEntries[iEntry].YMin,
@@ -1255,7 +1253,7 @@ int     TABMAPIndexBlock::SplitNode(GInt32 nNewEntryXMin, GInt32 nNewEntryYMin,
                                    pasSrcEntries[iEntry].nBlockPtr);
             continue;
         }
-        else if (poNewNode->GetNumEntries() >= TAB_MAX_ENTRIES_INDEX_BLOCK-1)
+        else if (poNewNode->GetNumEntries() >= GetMaxEntries()-1)
         {
             InsertEntry(pasSrcEntries[iEntry].XMin, 
                         pasSrcEntries[iEntry].YMin,
@@ -1350,7 +1348,7 @@ int TABMAPIndexBlock::SplitRootNode(GInt32 nNewEntryXMin, GInt32 nNewEntryYMin,
      *----------------------------------------------------------------*/
     TABMAPIndexBlock *poNewNode = new TABMAPIndexBlock(m_eAccess);
 
-    if (poNewNode->InitNewBlock(m_fp, 512, 
+    if (poNewNode->InitNewBlock(m_fp, m_nBlockSize, 
                                 m_poBlockManagerRef->AllocNewBlock("INDEX")) != 0)
     {
         return -1;
diff --git a/ogr/ogrsf_frmts/mitab/mitab_mapobjectblock.cpp b/ogr/ogrsf_frmts/mitab/mitab_mapobjectblock.cpp
index 34ad29d..b1771ae 100644
--- a/ogr/ogrsf_frmts/mitab/mitab_mapobjectblock.cpp
+++ b/ogr/ogrsf_frmts/mitab/mitab_mapobjectblock.cpp
@@ -209,7 +209,7 @@ int     TABMAPObjectBlock::InitBlockFromData(GByte *pabyBuf,
 
     /*-----------------------------------------------------------------
      * Set real value for m_nSizeUsed to allow random update
-     * (By default TABRawBinBlock thinks all 512 bytes are used)
+     * (By default TABRawBinBlock thinks all bytes are used)
      *----------------------------------------------------------------*/
     m_nSizeUsed = m_numDataBytes + MAP_OBJECT_HEADER_SIZE;
 
@@ -356,6 +356,7 @@ int     TABMAPObjectBlock::CommitToFile()
 
     WriteInt16(TABMAP_OBJECT_BLOCK);    // Block type code
     m_numDataBytes = m_nSizeUsed - MAP_OBJECT_HEADER_SIZE;
+    CPLAssert(m_numDataBytes >= 0 && m_numDataBytes < 32768);
     WriteInt16((GInt16)m_numDataBytes);         // num. bytes used
     
     WriteInt32(m_nCenterX);
@@ -740,7 +741,7 @@ void TABMAPObjectBlock::Dump(FILE *fpOut, GBool bDetails)
         TABMAPHeaderBlock *poHeader;
         TABMAPObjHdr *poObjHdr;
 
-        poBlock = TABCreateMAPBlockFromFile(m_fp, 0, 512);
+        poBlock = TABCreateMAPBlockFromFile(m_fp, 0, m_nBlockSize);
         if (poBlock==NULL || poBlock->GetBlockClass() != TABMAP_HEADER_BLOCK)
         {
             CPLError(CE_Failure, CPLE_AssertionFailed, 
diff --git a/ogr/ogrsf_frmts/mitab/mitab_maptoolblock.cpp b/ogr/ogrsf_frmts/mitab/mitab_maptoolblock.cpp
index 700cae2..521f19f 100644
--- a/ogr/ogrsf_frmts/mitab/mitab_maptoolblock.cpp
+++ b/ogr/ogrsf_frmts/mitab/mitab_maptoolblock.cpp
@@ -202,6 +202,7 @@ int     TABMAPToolBlock::CommitToFile()
     GotoByteInBlock(0x000);
 
     WriteInt16(TABMAP_TOOL_BLOCK);    // Block type code
+    CPLAssert(m_nSizeUsed >= MAP_TOOL_HEADER_SIZE && m_nSizeUsed < MAP_TOOL_HEADER_SIZE + 32768);
     WriteInt16((GInt16)(m_nSizeUsed - MAP_TOOL_HEADER_SIZE)); // num. bytes used
     WriteInt32(m_nNextToolBlock);
 
@@ -362,7 +363,7 @@ int  TABMAPToolBlock::WriteBytes(int nBytesToWrite, GByte *pabySrcBuf)
         SetNextToolBlock(nNewBlockOffset);
 
         if (CommitToFile() != 0 ||
-            InitNewBlock(m_fp, 512, nNewBlockOffset) != 0)
+            InitNewBlock(m_fp, m_nBlockSize, nNewBlockOffset) != 0)
         {
             // An error message should have already been reported.
             return -1;
@@ -412,7 +413,7 @@ int  TABMAPToolBlock::CheckAvailableSpace(int nToolType)
         SetNextToolBlock(nNewBlockOffset);
 
         if (CommitToFile() != 0 ||
-            InitNewBlock(m_fp, 512, nNewBlockOffset) != 0)
+            InitNewBlock(m_fp, m_nBlockSize, nNewBlockOffset) != 0)
         {
             // An error message should have already been reported.
             return -1;
diff --git a/ogr/ogrsf_frmts/mitab/mitab_middatafile.cpp b/ogr/ogrsf_frmts/mitab/mitab_middatafile.cpp
index 5aaae34..1f856af 100644
--- a/ogr/ogrsf_frmts/mitab/mitab_middatafile.cpp
+++ b/ogr/ogrsf_frmts/mitab/mitab_middatafile.cpp
@@ -213,9 +213,9 @@ const char *MIDDATAFile::GetLine()
         }
         else
         {
-            // skip leading spaces
-            while(pszLine && (*pszLine == ' ' || *pszLine == '\t') )
-                pszLine++;
+            // skip leading spaces and tabs (except is the delimiter is tab)
+            while(pszLine && (*pszLine == ' ' || (*m_pszDelimiter != '\t' && *pszLine == '\t')) )
+                    pszLine++;
 
             strncpy(m_szLastRead,pszLine,MIDMAXCHAR);
         }
diff --git a/ogr/ogrsf_frmts/mitab/mitab_ogr_datasource.cpp b/ogr/ogrsf_frmts/mitab/mitab_ogr_datasource.cpp
index e60f193..90661f4 100644
--- a/ogr/ogrsf_frmts/mitab/mitab_ogr_datasource.cpp
+++ b/ogr/ogrsf_frmts/mitab/mitab_ogr_datasource.cpp
@@ -101,6 +101,7 @@ OGRTABDataSource::OGRTABDataSource()
     m_bSingleFile = FALSE;
     m_bSingleLayerAlreadyCreated = FALSE;
     m_bQuickSpatialIndexMode = -1;
+    m_nBlockSize = 512;
     m_bUpdate = FALSE;
 }
 
@@ -154,6 +155,8 @@ int OGRTABDataSource::Create( const char * pszName, char **papszOptions )
             m_bQuickSpatialIndexMode = FALSE;
     }
 
+    m_nBlockSize = atoi(CSLFetchNameValueDef(papszOptions, "BLOCKSIZE", "512"));
+
 /* -------------------------------------------------------------------- */
 /*      Create a new empty directory.                                   */
 /* -------------------------------------------------------------------- */
@@ -192,14 +195,23 @@ int OGRTABDataSource::Create( const char * pszName, char **papszOptions )
         IMapInfoFile    *poFile;
 
         if( m_bCreateMIF )
+        {
             poFile = new MIFFile;
+            if( poFile->Open( m_pszName, TABWrite, FALSE ) != 0 )
+            {
+                delete poFile;
+                return FALSE;
+            }
+        }
         else
-            poFile = new TABFile;
-
-        if( poFile->Open( m_pszName, TABWrite, FALSE ) != 0 )
         {
-            delete poFile;
-            return FALSE;
+            TABFile* poTabFile = new TABFile;
+            if( poTabFile->Open( m_pszName, TABWrite, FALSE, m_nBlockSize ) != 0 )
+            {
+                delete poTabFile;
+                return FALSE;
+            }
+            poFile = poTabFile;
         }
         
         m_nLayerCount = 1;
diff --git a/ogr/ogrsf_frmts/mitab/mitab_ogr_driver.cpp b/ogr/ogrsf_frmts/mitab/mitab_ogr_driver.cpp
index 5565fcf..350f792 100644
--- a/ogr/ogrsf_frmts/mitab/mitab_ogr_driver.cpp
+++ b/ogr/ogrsf_frmts/mitab/mitab_ogr_driver.cpp
@@ -255,6 +255,7 @@ void RegisterOGRTAB()
 "    <Value>QUICK</Value>"
 "    <Value>OPTIMIZED</Value>"
 "  </Option>"
+"  <Option name='BLOCKSIZE' type='int' description='.map block size' min='512' max='32256' default='512'/>"
 "</CreationOptionList>");
         
         poDriver->SetMetadataItem( GDAL_DMD_CREATIONFIELDDATATYPES, "Integer Real String Date DateTime Time" );
diff --git a/ogr/ogrsf_frmts/mitab/mitab_ogr_driver.h b/ogr/ogrsf_frmts/mitab/mitab_ogr_driver.h
index ad7c857..19d1064 100644
--- a/ogr/ogrsf_frmts/mitab/mitab_ogr_driver.h
+++ b/ogr/ogrsf_frmts/mitab/mitab_ogr_driver.h
@@ -104,6 +104,7 @@ class OGRTABDataSource : public OGRDataSource
     int                 m_bSingleLayerAlreadyCreated;
     GBool               m_bQuickSpatialIndexMode;
     int                 m_bUpdate;
+    int                 m_nBlockSize;
 
   public:
                 OGRTABDataSource();
diff --git a/ogr/ogrsf_frmts/mitab/mitab_priv.h b/ogr/ogrsf_frmts/mitab/mitab_priv.h
index ff0d130..5173ea1 100644
--- a/ogr/ogrsf_frmts/mitab/mitab_priv.h
+++ b/ogr/ogrsf_frmts/mitab/mitab_priv.h
@@ -315,7 +315,10 @@ typedef struct TABMAPIndexEntry_t
     GInt32      nBlockPtr;
 }TABMAPIndexEntry;
 
-#define TAB_MAX_ENTRIES_INDEX_BLOCK     ((512-4)/20)
+#define TAB_MIN_BLOCK_SIZE              512
+#define TAB_MAX_BLOCK_SIZE              (32768-512)
+
+#define TAB_MAX_ENTRIES_INDEX_BLOCK     ((TAB_MAX_BLOCK_SIZE-4)/20)
 
 
 /*---------------------------------------------------------------------
@@ -837,9 +840,12 @@ class TABBinBlockManager
     char        m_szName[32]; /* for debug purposes */
 
   public:
-    TABBinBlockManager(int nBlockSize=512);
+    TABBinBlockManager();
     ~TABBinBlockManager();
 
+    void        SetBlockSize(int nBlockSize);
+    int         GetBlockSize() const { return m_nBlockSize; }
+
     GInt32      AllocNewBlock(const char* pszReason = "");
     void        Reset();
     void        SetLastPtr(int nBlockPtr) {m_nLastAllocatedBlock=nBlockPtr; };
@@ -885,7 +891,7 @@ class TABRawBinBlock
                    GBool bHardBlockSize = TRUE);
     virtual ~TABRawBinBlock();
 
-    virtual int ReadFromFile(VSILFILE *fpSrc, int nOffset, int nSize = 512);
+    virtual int ReadFromFile(VSILFILE *fpSrc, int nOffset, int nSize);
     virtual int CommitToFile();
     int         CommitAsDeleted(GInt32 nNextBlockPtr);
 
@@ -993,7 +999,7 @@ class TABMAPHeaderBlock: public TABRawBinBlock
     // LoadFromFile().  For this reason, this class should be used with care.
 
     GInt16      m_nMAPVersionNumber;
-    GInt16      m_nBlockSize;
+    GInt16      m_nRegularBlockSize;
     
     double      m_dCoordsys2DistUnits;
     GInt32      m_nXMin;
@@ -1062,6 +1068,8 @@ class TABMAPIndexBlock: public TABRawBinBlock
     TABMAPIndexBlock *m_poParentRef;
 
     int         ReadAllEntries();
+    
+    int         GetMaxEntries() const { return ((m_nBlockSize-4)/20); }
 
   public:
     TABMAPIndexBlock(TABAccess eAccessMode = TABRead);
@@ -1471,9 +1479,11 @@ class TABMAPFile
     ~TABMAPFile();
 
     int         Open(const char *pszFname, const char* pszAccess,
-                     GBool bNoErrorMsg = FALSE );
+                     GBool bNoErrorMsg = FALSE,
+                     int nBlockSizeForCreate = 512 );
     int         Open(const char *pszFname, TABAccess eAccess,
-                     GBool bNoErrorMsg = FALSE );
+                     GBool bNoErrorMsg = FALSE,
+                     int nBlockSizeForCreate = 512 );
     int         Close();
 
     int         SyncToDisk();
@@ -1942,7 +1952,7 @@ class MIDDATAFile
  =====================================================================*/
 
 TABRawBinBlock *TABCreateMAPBlockFromFile(VSILFILE *fpSrc, int nOffset, 
-                                          int nSize = 512, 
+                                          int nSize, 
                                           GBool bHardBlockSize = TRUE,
                                           TABAccess eAccessMode = TABRead);
 
diff --git a/ogr/ogrsf_frmts/mitab/mitab_rawbinblock.cpp b/ogr/ogrsf_frmts/mitab/mitab_rawbinblock.cpp
index 9b72e12..71afe0a 100644
--- a/ogr/ogrsf_frmts/mitab/mitab_rawbinblock.cpp
+++ b/ogr/ogrsf_frmts/mitab/mitab_rawbinblock.cpp
@@ -120,7 +120,7 @@ TABRawBinBlock::~TABRawBinBlock()
  * CPLError() will have been called.
  **********************************************************************/
 int     TABRawBinBlock::ReadFromFile(VSILFILE *fpSrc, int nOffset, 
-                                     int nSize /*= 512*/)
+                                     int nSize)
 {
     GByte *pabyBuf;
 
@@ -516,7 +516,7 @@ int     TABRawBinBlock::GotoByteRel(int nOffset)
  * bOffsetIsEndOfData is set to TRUE to indicate that the nOffset
  * to which we are attempting to go is the end of the used data in this
  * block (we are positioninig ourselves to append data), so if the nOffset 
- * corresponds to the beginning of a 512 bytes block then we should really 
+ * corresponds to the beginning of a block then we should really 
  * be positioning ourselves at the end of the block that ends at this 
  * address instead of at the beginning of the blocks that starts at this 
  * address. This case can happen when going back and forth to write collection
@@ -571,8 +571,8 @@ int     TABRawBinBlock::GotoByteInFile(int nOffset,
         //
         if (bOffsetIsEndOfData &&  nOffset%m_nBlockSize == 0)
         {
-            /* We're trying to go byte 512 of a block that's full of data.
-             * In this case it's okay to place the m_nCurPos at byte 512
+            /* We're trying to go byte m_nBlockSize of a block that's full of data.
+             * In this case it's okay to place the m_nCurPos at byte m_nBlockSize
              * which is past the end of the block.
              */
 
@@ -1077,7 +1077,7 @@ void TABRawBinBlock::DumpBytes(GInt32 nValue, int nOffset /*=0*/,
  * which case CPLError() will have been called.
  **********************************************************************/
 TABRawBinBlock *TABCreateMAPBlockFromFile(VSILFILE *fpSrc, int nOffset, 
-                                          int nSize /*= 512*/, 
+                                          int nSize, 
                                           GBool bHardBlockSize /*= TRUE */,
                                           TABAccess eAccessMode /*= TABRead*/)
 {
@@ -1165,10 +1165,10 @@ TABRawBinBlock *TABCreateMAPBlockFromFile(VSILFILE *fpSrc, int nOffset,
  *
  * Constructor.
  **********************************************************************/
-TABBinBlockManager::TABBinBlockManager(int nBlockSize /*=512*/)
+TABBinBlockManager::TABBinBlockManager()
 {
 
-    m_nBlockSize=nBlockSize;
+    m_nBlockSize=0;
     m_nLastAllocatedBlock = -1;
     m_psGarbageBlocksFirst = NULL;
     m_psGarbageBlocksLast = NULL;
@@ -1186,6 +1186,14 @@ TABBinBlockManager::~TABBinBlockManager()
 }
 
 /**********************************************************************
+ *                   TABBinBlockManager::SetBlockSize()
+ **********************************************************************/
+void TABBinBlockManager::SetBlockSize(int nBlockSize)
+{
+    m_nBlockSize = nBlockSize;
+}
+
+/**********************************************************************
  *                   TABBinBlockManager::SetName()
  **********************************************************************/
 void TABBinBlockManager::SetName(const char* pszName)
@@ -1217,7 +1225,10 @@ GInt32  TABBinBlockManager::AllocNewBlock(CPL_UNUSED const char* pszReason)
     if (m_nLastAllocatedBlock==-1)
         m_nLastAllocatedBlock = 0;
     else
+    {
+        CPLAssert(m_nBlockSize);
         m_nLastAllocatedBlock+=m_nBlockSize;
+    }
 
 #ifdef DEBUG_VERBOSE
     CPLDebug("MITAB", "AllocNewBlock(%s, %s) = %d", m_szName, pszReason, m_nLastAllocatedBlock);
diff --git a/ogr/ogrsf_frmts/mitab/mitab_spatialref.cpp b/ogr/ogrsf_frmts/mitab/mitab_spatialref.cpp
index 066b747..d8e5ab2 100644
--- a/ogr/ogrsf_frmts/mitab/mitab_spatialref.cpp
+++ b/ogr/ogrsf_frmts/mitab/mitab_spatialref.cpp
@@ -1689,7 +1689,7 @@ int TABFile::GetTABProjFromSpatialRef(const OGRSpatialReference* poSpatialRef,
         nParmCount = 3;
 
         if( ABS((ABS(parms[1]) - 90)) > 0.001 )
-            sTABProj.nProjId = 28;
+            sTABProj.nProjId = 29;
     }
 
     else if( EQUAL(pszProjection,SRS_PT_LAMBERT_CONFORMAL_CONIC_2SP) )
diff --git a/ogr/ogrsf_frmts/mitab/mitab_tabfile.cpp b/ogr/ogrsf_frmts/mitab/mitab_tabfile.cpp
index 8d4d93a..a99041e 100644
--- a/ogr/ogrsf_frmts/mitab/mitab_tabfile.cpp
+++ b/ogr/ogrsf_frmts/mitab/mitab_tabfile.cpp
@@ -248,7 +248,8 @@ void TABFile::ResetReading()
  * Returns 0 on success, -1 on error.
  **********************************************************************/
 int TABFile::Open(const char *pszFname, TABAccess eAccess,
-                  GBool bTestOpenNoError /*=FALSE*/ )
+                  GBool bTestOpenNoError /*=FALSE*/,
+                  int nBlockSizeForCreate)
 {
     char *pszTmpFname = NULL;
     int nFnameLen = 0;
@@ -478,10 +479,15 @@ int TABFile::Open(const char *pszFname, TABAccess eAccess,
             /* we leave it unknown indicating a mixture */
         }
     }
-    else if (m_poMAPFile->Open(pszTmpFname, eAccess) != 0)
+    else if (m_poMAPFile->Open(pszTmpFname, eAccess, FALSE, nBlockSizeForCreate) != 0)
     {
         // Open Failed for write... 
         // an error has already been reported, just return.
+
+        m_poMAPFile->Close();
+        delete m_poMAPFile;
+        m_poMAPFile = NULL;
+
         CPLFree(pszTmpFname);
         Close();
         if (bTestOpenNoError)
@@ -956,16 +962,17 @@ int TABFile::WriteTABFile()
 {
     VSILFILE *fp;
 
+    if (!m_bNeedTABRewrite )
+    {
+        return 0;
+    }
+
     if (m_poMAPFile == NULL || m_eAccessMode == TABRead)
     {
         CPLError(CE_Failure, CPLE_NotSupported,
                  "WriteTABFile() can be used only with Write access.");
         return -1;
     }
-    if (!m_bNeedTABRewrite )
-    {
-        return 0;
-    }
 
     // First update file version number...
     int nMapObjVersion = m_poMAPFile->GetMinTABFileVersion();
@@ -1088,14 +1095,14 @@ int TABFile::Close()
 
     // Commit the latest changes to the file...
     
-    // In Write access, it's time to write the .TAB file.
-    if (m_eAccessMode != TABRead)
-    {
-        WriteTABFile();
-    }
-
     if (m_poMAPFile)
     {
+        // In Write access, it's time to write the .TAB file.
+        if (m_eAccessMode != TABRead)
+        {
+            WriteTABFile();
+        }
+
         m_poMAPFile->Close();
         delete m_poMAPFile;
         m_poMAPFile = NULL;
diff --git a/ogr/ogrsf_frmts/mssqlspatial/ogrmssqlspatiallayer.cpp b/ogr/ogrsf_frmts/mssqlspatial/ogrmssqlspatiallayer.cpp
index 87cb03e..d6c7b89 100644
--- a/ogr/ogrsf_frmts/mssqlspatial/ogrmssqlspatiallayer.cpp
+++ b/ogr/ogrsf_frmts/mssqlspatial/ogrmssqlspatiallayer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrmssqlspatiallayer.cpp 29469 2015-07-04 11:42:30Z rouault $
+ * $Id: ogrmssqlspatiallayer.cpp 31802 2015-11-27 20:47:36Z rouault $
  *
  * 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 29469 2015-07-04 11:42:30Z rouault $");
+CPL_CVSID("$Id: ogrmssqlspatiallayer.cpp 31802 2015-11-27 20:47:36Z rouault $");
 /************************************************************************/
 /*                        OGRMSSQLSpatialLayer()                        */
 /************************************************************************/
@@ -143,14 +143,39 @@ CPLErr OGRMSSQLSpatialLayer::BuildFeatureDefn( const char *pszLayerName,
         {
 		    if (EQUAL(poStmt->GetColName(iCol), pszFIDColumn) )
             {
-                if (EQUALN(poStmt->GetColTypeName( iCol ), "bigint", 6))
-                    SetMetadataItem(OLMD_FID64, "YES");
-            
-                if ( EQUAL(poStmt->GetColTypeName( iCol ), "int identity") ||
-                     EQUAL(poStmt->GetColTypeName( iCol ), "bigint identity"))
-                    bIsIdentityFid = TRUE;
-                /* skip FID */
-                continue;
+                bool bIntegerFID = false;
+                switch( CPLODBCStatement::GetTypeMapping(poStmt->GetColType(iCol)) )
+                {
+                    case SQL_C_SSHORT:
+                    case SQL_C_USHORT:
+                    case SQL_C_SLONG:
+                    case SQL_C_ULONG:
+                    case SQL_C_SBIGINT:
+                    case SQL_C_UBIGINT:
+                        bIntegerFID = true;
+                        break;
+                    default:
+                        break;
+                }
+                if( !bIntegerFID )
+                {
+                    CPLDebug("MSSQL", "Ignoring FID column %s as it is of non integer type",
+                             pszFIDColumn);
+                    CPLFree(pszFIDColumn);
+                    pszFIDColumn = NULL;
+                }
+                else
+                {
+                    if (EQUALN(poStmt->GetColTypeName( iCol ), "bigint", strlen("bigint")))
+                        SetMetadataItem(OLMD_FID64, "YES");
+
+                    if ( EQUAL(poStmt->GetColTypeName( iCol ), "int identity") ||
+                        EQUAL(poStmt->GetColTypeName( iCol ), "bigint identity"))
+                        bIsIdentityFid = TRUE;
+
+                    /* skip FID */
+                    continue;
+                }
             }
         }
         else
diff --git a/ogr/ogrsf_frmts/ntf/ntfrecord.cpp b/ogr/ogrsf_frmts/ntf/ntfrecord.cpp
index 90d761c..c60d0cc 100644
--- a/ogr/ogrsf_frmts/ntf/ntfrecord.cpp
+++ b/ogr/ogrsf_frmts/ntf/ntfrecord.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ntfrecord.cpp 27044 2014-03-16 23:41:27Z rouault $
+ * $Id: ntfrecord.cpp 32416 2015-12-21 10:16:11Z rouault $
  *
  * Project:  NTF Translator
  * Purpose:  NTFRecord class implementation.
@@ -31,7 +31,7 @@
 #include "ntf.h"
 #include "cpl_conv.h"
 
-CPL_CVSID("$Id: ntfrecord.cpp 27044 2014-03-16 23:41:27Z rouault $");
+CPL_CVSID("$Id: ntfrecord.cpp 32416 2015-12-21 10:16:11Z rouault $");
 
 static int nFieldBufSize = 0;
 static char *pszFieldBuf = NULL;
@@ -69,7 +69,7 @@ NTFRecord::NTFRecord( FILE * fp )
         while( nNewLength > 0 && szLine[nNewLength-1] == ' ' )
                szLine[--nNewLength] = '\0';
 
-        if( szLine[nNewLength-1] != '%' )
+        if( nNewLength < 2 || szLine[nNewLength-1] != '%' )
         {
             CPLError( CE_Failure, CPLE_AppDefined, 
                       "Corrupt NTF record, missing end '%%'." );
@@ -92,7 +92,7 @@ NTFRecord::NTFRecord( FILE * fp )
         }
         else
         {
-            if( !EQUALN(szLine,"00",2) )
+            if( !EQUALN(szLine,"00",2) || nNewLength < 4 )
             {
                 CPLError( CE_Failure, CPLE_AppDefined, "Invalid line");
                 VSIFree(pszData);
diff --git a/ogr/ogrsf_frmts/openfilegdb/ogropenfilegdblayer.cpp b/ogr/ogrsf_frmts/openfilegdb/ogropenfilegdblayer.cpp
index 3762201..a718263 100644
--- a/ogr/ogrsf_frmts/openfilegdb/ogropenfilegdblayer.cpp
+++ b/ogr/ogrsf_frmts/openfilegdb/ogropenfilegdblayer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogropenfilegdblayer.cpp 29158 2015-05-05 21:19:37Z rouault $
+ * $Id: ogropenfilegdblayer.cpp 31070 2015-10-19 14:28:04Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Implements Open FileGDB OGR driver.
@@ -1740,7 +1740,7 @@ const OGRField* OGROpenFileGDBLayer::GetMinMaxValue(OGRFieldDefn* poFieldDefn,
                                                     int bIsMin,
                                                     int& eOutType)
 {
-    eOutType = OFTMaxType;
+    eOutType = -1;
     if( !BuildLayerDefinition() )
         return NULL;
 
diff --git a/ogr/ogrsf_frmts/pg/ogrpgdatasource.cpp b/ogr/ogrsf_frmts/pg/ogrpgdatasource.cpp
index 859bad0..4ecf66c 100644
--- a/ogr/ogrsf_frmts/pg/ogrpgdatasource.cpp
+++ b/ogr/ogrsf_frmts/pg/ogrpgdatasource.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrpgdatasource.cpp 29465 2015-07-03 08:51:45Z rouault $
+ * $Id: ogrpgdatasource.cpp 31320 2015-11-02 17:22:45Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Implements OGRPGDataSource class.
@@ -37,7 +37,7 @@
 
 #define PQexec this_is_an_error
 
-CPL_CVSID("$Id: ogrpgdatasource.cpp 29465 2015-07-03 08:51:45Z rouault $");
+CPL_CVSID("$Id: ogrpgdatasource.cpp 31320 2015-11-02 17:22:45Z rouault $");
 
 static void OGRPGNoticeProcessor( void *arg, const char * pszMessage );
 
@@ -2775,6 +2775,7 @@ OGRLayer * OGRPGDataSource::ExecuteSQL( const char *pszSQLCommand,
             
             osCommand.Printf( "CLOSE %s", "executeSQLCursor" );
             hResult = OGRPG_PQexec(hPGConn, osCommand );
+            OGRPGClearResult( hResult );
             
             SoftCommitTransaction();
 
@@ -2789,17 +2790,6 @@ OGRLayer * OGRPGDataSource::ExecuteSQL( const char *pszSQLCommand,
         }
     }
 
-/* -------------------------------------------------------------------- */
-/*      Generate an error report if an error occured.                   */
-/* -------------------------------------------------------------------- */
-    if( !hResult ||
-        (PQresultStatus(hResult) == PGRES_NONFATAL_ERROR
-         || PQresultStatus(hResult) == PGRES_FATAL_ERROR ) )
-    {
-        CPLError( CE_Failure, CPLE_AppDefined,
-                  "%s", PQerrorMessage( hPGConn ) );
-    }
-
     OGRPGClearResult( hResult );
 
     return NULL;
diff --git a/ogr/ogrsf_frmts/pgdump/ogrpgdumpdatasource.cpp b/ogr/ogrsf_frmts/pgdump/ogrpgdumpdatasource.cpp
index 7df03bd..7712dda 100644
--- a/ogr/ogrsf_frmts/pgdump/ogrpgdumpdatasource.cpp
+++ b/ogr/ogrsf_frmts/pgdump/ogrpgdumpdatasource.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrpgdumpdatasource.cpp 28988 2015-04-24 11:58:49Z rouault $
+ * $Id: ogrpgdumpdatasource.cpp 31741 2015-11-24 10:22:41Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Implements OGRPGDumpDataSource class.
@@ -32,7 +32,7 @@
 #include "cpl_conv.h"
 #include "cpl_string.h"
 
-CPL_CVSID("$Id: ogrpgdumpdatasource.cpp 28988 2015-04-24 11:58:49Z rouault $");
+CPL_CVSID("$Id: ogrpgdumpdatasource.cpp 31741 2015-11-24 10:22:41Z rouault $");
 
 /************************************************************************/
 /*                      OGRPGDumpDataSource()                           */
@@ -171,22 +171,21 @@ OGRPGDumpDataSource::ICreateLayer( const char * pszLayerName,
     const char* pszFIDColumnNameIn = CSLFetchNameValue(papszOptions, "FID");
     CPLString osFIDColumnName, osFIDColumnNameEscaped;
     if (pszFIDColumnNameIn == NULL)
-        osFIDColumnNameEscaped = osFIDColumnName = "OGC_FID";
+        osFIDColumnName = "ogc_fid";
     else
     {
         if( CSLFetchBoolean(papszOptions,"LAUNDER", TRUE) )
         {
             char* pszLaunderedFid = OGRPGCommonLaunderName(pszFIDColumnNameIn, "PGDump");
             osFIDColumnName = pszLaunderedFid;
-            osFIDColumnNameEscaped = OGRPGDumpEscapeColumnName(osFIDColumnName);
             CPLFree(pszLaunderedFid);
         }
         else
         {
             osFIDColumnName = pszFIDColumnNameIn;
-            osFIDColumnNameEscaped = OGRPGDumpEscapeColumnName(osFIDColumnName);
         }
     }
+    osFIDColumnNameEscaped = OGRPGDumpEscapeColumnName(osFIDColumnName);
 
     if (strncmp(pszLayerName, "pg", 2) == 0)
     {
diff --git a/ogr/ogrsf_frmts/shape/ogrshapelayer.cpp b/ogr/ogrsf_frmts/shape/ogrshapelayer.cpp
index c172754..d6666f7 100644
--- a/ogr/ogrsf_frmts/shape/ogrshapelayer.cpp
+++ b/ogr/ogrsf_frmts/shape/ogrshapelayer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrshapelayer.cpp 29066 2015-04-30 08:50:05Z rouault $
+ * $Id: ogrshapelayer.cpp 32350 2015-12-20 17:46:02Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Implements OGRShapeLayer class.
@@ -44,7 +44,7 @@
 
 #define UNSUPPORTED_OP_READ_ONLY "%s : unsupported operation on a read-only datasource."
 
-CPL_CVSID("$Id: ogrshapelayer.cpp 29066 2015-04-30 08:50:05Z rouault $");
+CPL_CVSID("$Id: ogrshapelayer.cpp 32350 2015-12-20 17:46:02Z rouault $");
 
 /************************************************************************/
 /*                           OGRShapeLayer()                            */
@@ -2528,7 +2528,8 @@ OGRErr OGRShapeLayer::Repack()
 /* -------------------------------------------------------------------- */
 /*      Update total shape count.                                       */
 /* -------------------------------------------------------------------- */
-    nTotalShapeCount = hDBF->nRecords;
+    if( hDBF != NULL )
+        nTotalShapeCount = hDBF->nRecords;
     bSHPNeedsRepack = FALSE;
 
     return OGRERR_NONE;
diff --git a/ogr/ogrsf_frmts/shape/shape2ogr.cpp b/ogr/ogrsf_frmts/shape/shape2ogr.cpp
index 3a22036..84e750f 100644
--- a/ogr/ogrsf_frmts/shape/shape2ogr.cpp
+++ b/ogr/ogrsf_frmts/shape/shape2ogr.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: shape2ogr.cpp 29234 2015-05-22 19:17:03Z rouault $
+ * $Id: shape2ogr.cpp 33049 2016-01-19 15:52:01Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Implements translation of Shapefile shapes into OGR
@@ -32,7 +32,7 @@
 #include "ogrshape.h"
 #include "cpl_conv.h"
 
-CPL_CVSID("$Id: shape2ogr.cpp 29234 2015-05-22 19:17:03Z rouault $");
+CPL_CVSID("$Id: shape2ogr.cpp 33049 2016-01-19 15:52:01Z rouault $");
 
 /************************************************************************/
 /*                        RingStartEnd                                  */
@@ -118,9 +118,10 @@ OGRGeometry *SHPReadOGRObject( SHPHandle hSHP, int iShape, SHPObject *psShape )
     }
     else if(psShape->nSHPType == SHPT_POINTM )
     {
+        /* padfM will be always not NULL in the case */
         // Read XYM as XYZ
         poOGR = new OGRPoint( psShape->padfX[0], psShape->padfY[0],
-                              psShape->padfM[0] );
+                            psShape->padfM[0] );
     }
 /* -------------------------------------------------------------------- */
 /*      Multipoint.                                                     */
@@ -177,7 +178,7 @@ OGRGeometry *SHPReadOGRObject( SHPHandle hSHP, int iShape, SHPObject *psShape )
             if( psShape->nSHPType == SHPT_ARCZ )
                 poOGRLine->setPoints( psShape->nVertices,
                                     psShape->padfX, psShape->padfY, psShape->padfZ );
-            else if( psShape->nSHPType == SHPT_ARCM )
+            else if( psShape->nSHPType == SHPT_ARCM && psShape->padfM != NULL )
                 // Read XYM as XYZ
                 poOGRLine->setPoints( psShape->nVertices,
                                     psShape->padfX, psShape->padfY, psShape->padfM );
@@ -224,7 +225,7 @@ OGRGeometry *SHPReadOGRObject( SHPHandle hSHP, int iShape, SHPObject *psShape )
                                     psShape->padfX + nRingStart,
                                     psShape->padfY + nRingStart,
                                     psShape->padfZ + nRingStart );
-                else if( psShape->nSHPType == SHPT_ARCM )
+                else if( psShape->nSHPType == SHPT_ARCM && psShape->padfM != NULL )
                     // Read XYM as XYZ
                     poLine->setPoints( nRingPoints,
                                     psShape->padfX + nRingStart,
diff --git a/ogr/ogrsf_frmts/vrt/ogrvrtlayer.cpp b/ogr/ogrsf_frmts/vrt/ogrvrtlayer.cpp
index 2efa705..be4f9df 100644
--- a/ogr/ogrsf_frmts/vrt/ogrvrtlayer.cpp
+++ b/ogr/ogrsf_frmts/vrt/ogrvrtlayer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrvrtlayer.cpp 29330 2015-06-14 12:11:11Z rouault $
+ * $Id: ogrvrtlayer.cpp 32515 2015-12-29 10:09:08Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Implements OGRVRTLayer class.
@@ -34,7 +34,7 @@
 #include "ogrpgeogeometry.h"
 #include <string>
 
-CPL_CVSID("$Id: ogrvrtlayer.cpp 29330 2015-06-14 12:11:11Z rouault $");
+CPL_CVSID("$Id: ogrvrtlayer.cpp 32515 2015-12-29 10:09:08Z rouault $");
 
 #define UNSUPPORTED_OP_READ_ONLY "%s : unsupported operation on a read-only datasource."
 
@@ -1043,7 +1043,8 @@ try_again:
                     (iSrcField == apoGeomFieldProps[iGF]->iGeomXField ||
                      iSrcField == apoGeomFieldProps[iGF]->iGeomYField ||
                      iSrcField == apoGeomFieldProps[iGF]->iGeomZField ||
-                     iSrcField == apoGeomFieldProps[iGF]->iGeomField) )
+                     (apoGeomFieldProps[iGF]->eGeometryStyle != VGS_Direct &&
+                      iSrcField == apoGeomFieldProps[iGF]->iGeomField)) )
                 {
                     bSkip = TRUE;
                     break;
@@ -1824,7 +1825,8 @@ OGRFeature* OGRVRTLayer::TranslateVRTFeatureToSrcFeature( OGRFeature* poVRTFeatu
         for(int i = 0; i < poFeatureDefn->GetGeomFieldCount(); i++ )
         {
             /* Do not set source geometry columns. Have been set just above */
-            if (anSrcField[iVRTField] == apoGeomFieldProps[i]->iGeomField ||
+            if ((apoGeomFieldProps[i]->eGeometryStyle != VGS_Direct &&
+                 anSrcField[iVRTField] == apoGeomFieldProps[i]->iGeomField) ||
                 anSrcField[iVRTField] == apoGeomFieldProps[i]->iGeomXField ||
                 anSrcField[iVRTField] == apoGeomFieldProps[i]->iGeomYField ||
                 anSrcField[iVRTField] == apoGeomFieldProps[i]->iGeomZField)
diff --git a/port/cpl_path.cpp b/port/cpl_path.cpp
index a27f22b..023a203 100644
--- a/port/cpl_path.cpp
+++ b/port/cpl_path.cpp
@@ -1,5 +1,5 @@
 /**********************************************************************
- * $Id: cpl_path.cpp 27044 2014-03-16 23:41:27Z rouault $
+ * $Id: cpl_path.cpp 32986 2016-01-14 20:40:01Z rouault $
  *
  * Project:  CPL - Common Portability Library
  * Purpose:  Portable filename/path parsing, and forming ala "Glob API".
@@ -32,7 +32,7 @@
 #include "cpl_string.h"
 #include "cpl_multiproc.h"
 
-CPL_CVSID("$Id: cpl_path.cpp 27044 2014-03-16 23:41:27Z rouault $");
+CPL_CVSID("$Id: cpl_path.cpp 32986 2016-01-14 20:40:01Z rouault $");
 
 
 /* should be size of larged possible filename */
@@ -480,7 +480,8 @@ const char *CPLFormFilename( const char * pszPath,
     {
         /* FIXME? would be better to ask the filesystems what they */
         /* prefer as directory separator */
-        if (strncmp(pszPath, "/vsicurl/", 9) == 0)
+        if (strncmp(pszPath, "/vsicurl/", 9) == 0 ||
+            strncmp(pszPath, "/vsicurl_streaming/", strlen("/vsicurl_streaming/")) == 0)
             pszAddedPathSep = "/";
         else if (strncmp(pszPath, "/vsizip/", 8) == 0)
             pszAddedPathSep = "/";
diff --git a/port/cpl_string.cpp b/port/cpl_string.cpp
index 72b29bb..6c04a8a 100644
--- a/port/cpl_string.cpp
+++ b/port/cpl_string.cpp
@@ -1,5 +1,5 @@
 /**********************************************************************
- * $Id: cpl_string.cpp 28689 2015-03-08 20:05:50Z rouault $
+ * $Id: cpl_string.cpp 32962 2016-01-13 09:11:55Z rouault $
  *
  * Name:     cpl_string.cpp
  * Project:  CPL - Common Portability Library
@@ -57,7 +57,7 @@
 #  include <wce_string.h>
 #endif
 
-CPL_CVSID("$Id: cpl_string.cpp 28689 2015-03-08 20:05:50Z rouault $");
+CPL_CVSID("$Id: cpl_string.cpp 32962 2016-01-13 09:11:55Z rouault $");
 
 /*=====================================================================
                     StringList manipulation functions.
@@ -2444,40 +2444,45 @@ CPLValueType CPLGetValueType(const char* pszValue)
 {
     /*
     doubles : "+25.e+3", "-25.e-3", "25.e3", "25e3", " 25e3 "
-    not doubles: "25e 3", "25e.3", "-2-5e3", "2-5e3", "25.25.3", "-3d"
+    not doubles: "25e 3", "25e.3", "-2-5e3", "2-5e3", "25.25.3", "-3d", "d1"
+                 "XXeYYYYYYYYYYYYYYYYYYY" that evaluates to infinity
     */
 
-    int bFoundDot = FALSE;
-    int bFoundExponent = FALSE;
-    int bIsLastCharExponent = FALSE;
-    int bIsReal = FALSE;
-
     if (pszValue == NULL)
         return CPL_VALUE_STRING;
 
+    const char* pszValueInit = pszValue;
+
     /* Skip leading spaces */
-    while( isspace( (unsigned char)*pszValue ) )
-        pszValue ++;
+    while( isspace( *pszValue ) )
+        ++pszValue;
 
     if (*pszValue == '\0')
         return CPL_VALUE_STRING;
 
     /* Skip leading + or - */
     if (*pszValue == '+' || *pszValue == '-')
-        pszValue ++;
+        ++pszValue;
+
+    bool bFoundDot = false;
+    bool bFoundExponent = false;
+    bool bIsLastCharExponent = false;
+    bool bIsReal = false;
+    const char* pszAfterExponent = NULL;
+    bool bFoundMantissa = false;
 
-    for(; *pszValue != '\0'; pszValue++ )
+    for(; *pszValue != '\0'; ++pszValue )
     {
         if( isdigit( *pszValue))
         {
-            bIsLastCharExponent = FALSE;
-            /* do nothing */
+            bIsLastCharExponent = false;
+            bFoundMantissa = true;
         }
-        else if ( isspace ((unsigned char)*pszValue) )
+        else if ( isspace( *pszValue ) )
         {
             const char* pszTmp = pszValue;
-            while( isspace( (unsigned char)*pszTmp ) )
-                pszTmp ++;
+            while( isspace( *pszTmp ) )
+                ++pszTmp;
             if (*pszTmp == 0)
                 break;
             else
@@ -2491,37 +2496,47 @@ CPLValueType CPLGetValueType(const char* pszValue)
             }
             else
                 return CPL_VALUE_STRING;
-            bIsLastCharExponent = FALSE;
+            bIsLastCharExponent = false;
         }
         else if ( *pszValue == '.')
         {
-            bIsReal = TRUE;
-            if (!bFoundDot && bIsLastCharExponent == FALSE)
-                bFoundDot = TRUE;
+            bIsReal = true;
+            if (!bFoundDot && !bIsLastCharExponent)
+                bFoundDot = true;
             else
                 return CPL_VALUE_STRING;
-            bIsLastCharExponent = FALSE;
+            bIsLastCharExponent = false;
         }
         else if (*pszValue == 'D' || *pszValue == 'd'
                  || *pszValue == 'E' || *pszValue == 'e' )
         {
+            if( !bFoundMantissa )
+                return CPL_VALUE_STRING;
             if (!(pszValue[1] == '+' || pszValue[1] == '-' ||
                   isdigit(pszValue[1])))
                 return CPL_VALUE_STRING;
 
-            bIsReal = TRUE;
+            bIsReal = true;
             if (!bFoundExponent)
-                bFoundExponent = TRUE;
+                bFoundExponent = true;
             else
                 return CPL_VALUE_STRING;
-            bIsLastCharExponent = TRUE;
+            pszAfterExponent = pszValue + 1;
+            bIsLastCharExponent = true;
         }
-        else 
+        else
         {
             return CPL_VALUE_STRING;
         }
     }
 
+    if( bIsReal && pszAfterExponent && strlen(pszAfterExponent) > 3 )
+    {
+        const double dfVal = CPLAtof(pszValueInit);
+        if( CPLIsInf(dfVal) )
+            return CPL_VALUE_STRING;
+    }
+
     return (bIsReal) ? CPL_VALUE_REAL : CPL_VALUE_INTEGER;
 }
 
diff --git a/port/cpl_vsil_stdout.cpp b/port/cpl_vsil_stdout.cpp
index faeb037..3019fcd 100644
--- a/port/cpl_vsil_stdout.cpp
+++ b/port/cpl_vsil_stdout.cpp
@@ -1,5 +1,5 @@
 /**********************************************************************
- * $Id: cpl_vsil_stdout.cpp 27745 2014-09-27 16:38:57Z goatbar $
+ * $Id: cpl_vsil_stdout.cpp 30996 2015-10-13 16:57:03Z rouault $
  *
  * Project:  CPL - Common Portability Library
  * Purpose:  Implement VSI large file api for stdout
@@ -37,7 +37,7 @@
 #include <fcntl.h>
 #endif
 
-CPL_CVSID("$Id: cpl_vsil_stdout.cpp 27745 2014-09-27 16:38:57Z goatbar $");
+CPL_CVSID("$Id: cpl_vsil_stdout.cpp 30996 2015-10-13 16:57:03Z rouault $");
 
 static VSIWriteFunction pWriteFunction = fwrite;
 static FILE* pWriteStream = stdout;
@@ -176,7 +176,7 @@ int VSIStdoutHandle::Eof()
 int VSIStdoutHandle::Close()
 
 {
-    return 0;
+    return Flush();
 }
 
 /************************************************************************/
diff --git a/swig/csharp/const/GdalConst.cs b/swig/csharp/const/GdalConst.cs
index ac4496a..69ba2f3 100644
--- a/swig/csharp/const/GdalConst.cs
+++ b/swig/csharp/const/GdalConst.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/const/GdalConstPINVOKE.cs b/swig/csharp/const/GdalConstPINVOKE.cs
index 2178287..30deb30 100644
--- a/swig/csharp/const/GdalConstPINVOKE.cs
+++ b/swig/csharp/const/GdalConstPINVOKE.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/const/gdalconst_wrap.c b/swig/csharp/const/gdalconst_wrap.c
index 0ad634a..edc1f86 100644
--- a/swig/csharp/const/gdalconst_wrap.c
+++ b/swig/csharp/const/gdalconst_wrap.c
@@ -1,11 +1,11 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
- * 
- * This file is not intended to be easily readable and contains a number of 
+ * Version 2.0.12
+ *
+ * This file is not intended to be easily readable and contains a number of
  * coding conventions designed to improve portability and efficiency. Do not make
- * changes to this file unless you know what you are doing--modify the SWIG 
- * interface file instead. 
+ * changes to this file unless you know what you are doing--modify the SWIG
+ * interface file instead.
  * ----------------------------------------------------------------------------- */
 
 #define SWIGCSHARP
@@ -41,28 +41,28 @@
 #ifndef SWIGUNUSED
 # if defined(__GNUC__)
 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#     define SWIGUNUSED __attribute__ ((__unused__))
 #   else
 #     define SWIGUNUSED
 #   endif
 # elif defined(__ICC)
-#   define SWIGUNUSED __attribute__ ((__unused__)) 
+#   define SWIGUNUSED __attribute__ ((__unused__))
 # else
-#   define SWIGUNUSED 
+#   define SWIGUNUSED
 # endif
 #endif
 
 #ifndef SWIG_MSC_UNSUPPRESS_4505
 # if defined(_MSC_VER)
 #   pragma warning(disable : 4505) /* unreferenced local function has been removed */
-# endif 
+# endif
 #endif
 
 #ifndef SWIGUNUSEDPARM
 # ifdef __cplusplus
 #   define SWIGUNUSEDPARM(p)
 # else
-#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
 # endif
 #endif
 
@@ -105,7 +105,7 @@
 #   define SWIGSTDCALL __stdcall
 # else
 #   define SWIGSTDCALL
-# endif 
+# endif
 #endif
 
 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
diff --git a/swig/csharp/gdal/Access.cs b/swig/csharp/gdal/Access.cs
index 799ff1d..49be466 100644
--- a/swig/csharp/gdal/Access.cs
+++ b/swig/csharp/gdal/Access.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/gdal/AsyncReader.cs b/swig/csharp/gdal/AsyncReader.cs
index 0918163..a70063f 100644
--- a/swig/csharp/gdal/AsyncReader.cs
+++ b/swig/csharp/gdal/AsyncReader.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/gdal/AsyncStatusType.cs b/swig/csharp/gdal/AsyncStatusType.cs
index 399b581..dd56ded 100644
--- a/swig/csharp/gdal/AsyncStatusType.cs
+++ b/swig/csharp/gdal/AsyncStatusType.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/gdal/Band.cs b/swig/csharp/gdal/Band.cs
index a74e351..bc5a31e 100644
--- a/swig/csharp/gdal/Band.cs
+++ b/swig/csharp/gdal/Band.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/gdal/CPLErr.cs b/swig/csharp/gdal/CPLErr.cs
index 7aea976..0fce144 100644
--- a/swig/csharp/gdal/CPLErr.cs
+++ b/swig/csharp/gdal/CPLErr.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/gdal/ColorEntry.cs b/swig/csharp/gdal/ColorEntry.cs
index 5edf849..e1ecfb9 100644
--- a/swig/csharp/gdal/ColorEntry.cs
+++ b/swig/csharp/gdal/ColorEntry.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/gdal/ColorInterp.cs b/swig/csharp/gdal/ColorInterp.cs
index 5cd5b44..e576940 100644
--- a/swig/csharp/gdal/ColorInterp.cs
+++ b/swig/csharp/gdal/ColorInterp.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/gdal/ColorTable.cs b/swig/csharp/gdal/ColorTable.cs
index 7f8cd6a..ee7467e 100644
--- a/swig/csharp/gdal/ColorTable.cs
+++ b/swig/csharp/gdal/ColorTable.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/gdal/DataType.cs b/swig/csharp/gdal/DataType.cs
index ce3a109..d7f4a63 100644
--- a/swig/csharp/gdal/DataType.cs
+++ b/swig/csharp/gdal/DataType.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/gdal/Dataset.cs b/swig/csharp/gdal/Dataset.cs
index 5523b51..afe8ec1 100644
--- a/swig/csharp/gdal/Dataset.cs
+++ b/swig/csharp/gdal/Dataset.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/gdal/Driver.cs b/swig/csharp/gdal/Driver.cs
index 5bec748..af88d75 100644
--- a/swig/csharp/gdal/Driver.cs
+++ b/swig/csharp/gdal/Driver.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/gdal/GCP.cs b/swig/csharp/gdal/GCP.cs
index 6ae06ad..ff5f0b4 100644
--- a/swig/csharp/gdal/GCP.cs
+++ b/swig/csharp/gdal/GCP.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/gdal/Gdal.cs b/swig/csharp/gdal/Gdal.cs
index 9a497a5..7f0fe97 100644
--- a/swig/csharp/gdal/Gdal.cs
+++ b/swig/csharp/gdal/Gdal.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/gdal/GdalPINVOKE.cs b/swig/csharp/gdal/GdalPINVOKE.cs
index f83a6ad..10f2b1d 100644
--- a/swig/csharp/gdal/GdalPINVOKE.cs
+++ b/swig/csharp/gdal/GdalPINVOKE.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/gdal/MajorObject.cs b/swig/csharp/gdal/MajorObject.cs
index c9ae66a..f9a52d2 100644
--- a/swig/csharp/gdal/MajorObject.cs
+++ b/swig/csharp/gdal/MajorObject.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/gdal/PaletteInterp.cs b/swig/csharp/gdal/PaletteInterp.cs
index ff92f5f..def61b5 100644
--- a/swig/csharp/gdal/PaletteInterp.cs
+++ b/swig/csharp/gdal/PaletteInterp.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/gdal/RATFieldType.cs b/swig/csharp/gdal/RATFieldType.cs
index 88b4643..d4b909e 100644
--- a/swig/csharp/gdal/RATFieldType.cs
+++ b/swig/csharp/gdal/RATFieldType.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/gdal/RATFieldUsage.cs b/swig/csharp/gdal/RATFieldUsage.cs
index b76130d..dedfc62 100644
--- a/swig/csharp/gdal/RATFieldUsage.cs
+++ b/swig/csharp/gdal/RATFieldUsage.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/gdal/RIOResampleAlg.cs b/swig/csharp/gdal/RIOResampleAlg.cs
index 5bca742..53464b1 100644
--- a/swig/csharp/gdal/RIOResampleAlg.cs
+++ b/swig/csharp/gdal/RIOResampleAlg.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/gdal/RWFlag.cs b/swig/csharp/gdal/RWFlag.cs
index 3a6c35c..f39fdf9 100644
--- a/swig/csharp/gdal/RWFlag.cs
+++ b/swig/csharp/gdal/RWFlag.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/gdal/RasterAttributeTable.cs b/swig/csharp/gdal/RasterAttributeTable.cs
index b81cda1..a999d9c 100644
--- a/swig/csharp/gdal/RasterAttributeTable.cs
+++ b/swig/csharp/gdal/RasterAttributeTable.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/gdal/ResampleAlg.cs b/swig/csharp/gdal/ResampleAlg.cs
index 8c2d425..06a46c0 100644
--- a/swig/csharp/gdal/ResampleAlg.cs
+++ b/swig/csharp/gdal/ResampleAlg.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/gdal/SWIGTYPE_p_p_GDALRasterBandShadow.cs b/swig/csharp/gdal/SWIGTYPE_p_p_GDALRasterBandShadow.cs
index 087857a..e8bb6e9 100644
--- a/swig/csharp/gdal/SWIGTYPE_p_p_GDALRasterBandShadow.cs
+++ b/swig/csharp/gdal/SWIGTYPE_p_p_GDALRasterBandShadow.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/gdal/Transformer.cs b/swig/csharp/gdal/Transformer.cs
index 6e868df..63a9908 100644
--- a/swig/csharp/gdal/Transformer.cs
+++ b/swig/csharp/gdal/Transformer.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/gdal/XMLNode.cs b/swig/csharp/gdal/XMLNode.cs
index bdee68c..3766757 100644
--- a/swig/csharp/gdal/XMLNode.cs
+++ b/swig/csharp/gdal/XMLNode.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/gdal/XMLNodeType.cs b/swig/csharp/gdal/XMLNodeType.cs
index da591bb..8331c8a 100644
--- a/swig/csharp/gdal/XMLNodeType.cs
+++ b/swig/csharp/gdal/XMLNodeType.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/gdal/gdal_wrap.cpp b/swig/csharp/gdal/gdal_wrap.cpp
index c85bd59..e13ed2d 100644
--- a/swig/csharp/gdal/gdal_wrap.cpp
+++ b/swig/csharp/gdal/gdal_wrap.cpp
@@ -1,11 +1,11 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
- * 
- * This file is not intended to be easily readable and contains a number of 
+ * Version 2.0.12
+ *
+ * This file is not intended to be easily readable and contains a number of
  * coding conventions designed to improve portability and efficiency. Do not make
- * changes to this file unless you know what you are doing--modify the SWIG 
- * interface file instead. 
+ * changes to this file unless you know what you are doing--modify the SWIG
+ * interface file instead.
  * ----------------------------------------------------------------------------- */
 
 #define SWIGCSHARP
@@ -65,28 +65,28 @@ template <typename T> T SwigValueInit() {
 #ifndef SWIGUNUSED
 # if defined(__GNUC__)
 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#     define SWIGUNUSED __attribute__ ((__unused__))
 #   else
 #     define SWIGUNUSED
 #   endif
 # elif defined(__ICC)
-#   define SWIGUNUSED __attribute__ ((__unused__)) 
+#   define SWIGUNUSED __attribute__ ((__unused__))
 # else
-#   define SWIGUNUSED 
+#   define SWIGUNUSED
 # endif
 #endif
 
 #ifndef SWIG_MSC_UNSUPPRESS_4505
 # if defined(_MSC_VER)
 #   pragma warning(disable : 4505) /* unreferenced local function has been removed */
-# endif 
+# endif
 #endif
 
 #ifndef SWIGUNUSEDPARM
 # ifdef __cplusplus
 #   define SWIGUNUSEDPARM(p)
 # else
-#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
 # endif
 #endif
 
@@ -129,7 +129,7 @@ template <typename T> T SwigValueInit() {
 #   define SWIGSTDCALL __stdcall
 # else
 #   define SWIGSTDCALL
-# endif 
+# endif
 #endif
 
 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
@@ -280,18 +280,18 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterStringCallback_Gdal(SWIG_CSharpStringHel
 #define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentOutOfRangeException, msg, ""); return nullreturn; } else
 
 /*  Errors in SWIG */
-#define  SWIG_UnknownError    	   -1 
-#define  SWIG_IOError        	   -2 
-#define  SWIG_RuntimeError   	   -3 
-#define  SWIG_IndexError     	   -4 
-#define  SWIG_TypeError      	   -5 
-#define  SWIG_DivisionByZero 	   -6 
-#define  SWIG_OverflowError  	   -7 
-#define  SWIG_SyntaxError    	   -8 
-#define  SWIG_ValueError     	   -9 
+#define  SWIG_UnknownError    	   -1
+#define  SWIG_IOError        	   -2
+#define  SWIG_RuntimeError   	   -3
+#define  SWIG_IndexError     	   -4
+#define  SWIG_TypeError      	   -5
+#define  SWIG_DivisionByZero 	   -6
+#define  SWIG_OverflowError  	   -7
+#define  SWIG_SyntaxError    	   -8
+#define  SWIG_ValueError     	   -9
 #define  SWIG_SystemError    	   -10
 #define  SWIG_AttributeError 	   -11
-#define  SWIG_MemoryError    	   -12 
+#define  SWIG_MemoryError    	   -12
 #define  SWIG_NullReferenceError   -13
 
 
diff --git a/swig/csharp/ogr/CoordinateTransformation.cs b/swig/csharp/ogr/CoordinateTransformation.cs
index 90a2c4a..85ba1ab 100644
--- a/swig/csharp/ogr/CoordinateTransformation.cs
+++ b/swig/csharp/ogr/CoordinateTransformation.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/ogr/DataSource.cs b/swig/csharp/ogr/DataSource.cs
index 1fe8a26..112e92a 100644
--- a/swig/csharp/ogr/DataSource.cs
+++ b/swig/csharp/ogr/DataSource.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/ogr/Driver.cs b/swig/csharp/ogr/Driver.cs
index 4f3522a..698f06c 100644
--- a/swig/csharp/ogr/Driver.cs
+++ b/swig/csharp/ogr/Driver.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/ogr/Envelope.cs b/swig/csharp/ogr/Envelope.cs
index e5d05c5..9fe7e52 100644
--- a/swig/csharp/ogr/Envelope.cs
+++ b/swig/csharp/ogr/Envelope.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/ogr/Envelope3D.cs b/swig/csharp/ogr/Envelope3D.cs
index 44b8f13..2f2f7e8 100644
--- a/swig/csharp/ogr/Envelope3D.cs
+++ b/swig/csharp/ogr/Envelope3D.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/ogr/Feature.cs b/swig/csharp/ogr/Feature.cs
index 49dddd6..c0d2c2d 100644
--- a/swig/csharp/ogr/Feature.cs
+++ b/swig/csharp/ogr/Feature.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/ogr/FeatureDefn.cs b/swig/csharp/ogr/FeatureDefn.cs
index b23fedc..82f0cd0 100644
--- a/swig/csharp/ogr/FeatureDefn.cs
+++ b/swig/csharp/ogr/FeatureDefn.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/ogr/FieldDefn.cs b/swig/csharp/ogr/FieldDefn.cs
index 3108beb..ab04556 100644
--- a/swig/csharp/ogr/FieldDefn.cs
+++ b/swig/csharp/ogr/FieldDefn.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/ogr/FieldSubType.cs b/swig/csharp/ogr/FieldSubType.cs
index 94bc656..fe284a7 100644
--- a/swig/csharp/ogr/FieldSubType.cs
+++ b/swig/csharp/ogr/FieldSubType.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/ogr/FieldType.cs b/swig/csharp/ogr/FieldType.cs
index bfb20d5..e1e80ed 100644
--- a/swig/csharp/ogr/FieldType.cs
+++ b/swig/csharp/ogr/FieldType.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/ogr/GeomFieldDefn.cs b/swig/csharp/ogr/GeomFieldDefn.cs
index abd167d..866b4e7 100644
--- a/swig/csharp/ogr/GeomFieldDefn.cs
+++ b/swig/csharp/ogr/GeomFieldDefn.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/ogr/Geometry.cs b/swig/csharp/ogr/Geometry.cs
index b46b3d7..dcf1a66 100644
--- a/swig/csharp/ogr/Geometry.cs
+++ b/swig/csharp/ogr/Geometry.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/ogr/Justification.cs b/swig/csharp/ogr/Justification.cs
index df0e4e0..04a8ace 100644
--- a/swig/csharp/ogr/Justification.cs
+++ b/swig/csharp/ogr/Justification.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/ogr/Layer.cs b/swig/csharp/ogr/Layer.cs
index 1beecf8..718ca20 100644
--- a/swig/csharp/ogr/Layer.cs
+++ b/swig/csharp/ogr/Layer.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/ogr/Ogr.cs b/swig/csharp/ogr/Ogr.cs
index 901b2df..0207002 100644
--- a/swig/csharp/ogr/Ogr.cs
+++ b/swig/csharp/ogr/Ogr.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/ogr/OgrPINVOKE.cs b/swig/csharp/ogr/OgrPINVOKE.cs
index c6357c7..8279fa8 100644
--- a/swig/csharp/ogr/OgrPINVOKE.cs
+++ b/swig/csharp/ogr/OgrPINVOKE.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/ogr/Osr.cs b/swig/csharp/ogr/Osr.cs
index bfa2933..c0ed9ad 100644
--- a/swig/csharp/ogr/Osr.cs
+++ b/swig/csharp/ogr/Osr.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/ogr/OsrPINVOKE.cs b/swig/csharp/ogr/OsrPINVOKE.cs
index f5915f6..c28447f 100644
--- a/swig/csharp/ogr/OsrPINVOKE.cs
+++ b/swig/csharp/ogr/OsrPINVOKE.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/ogr/SpatialReference.cs b/swig/csharp/ogr/SpatialReference.cs
index 185fa4a..f2d9c2a 100644
--- a/swig/csharp/ogr/SpatialReference.cs
+++ b/swig/csharp/ogr/SpatialReference.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/ogr/StyleTable.cs b/swig/csharp/ogr/StyleTable.cs
index dac966b..fccc6c6 100644
--- a/swig/csharp/ogr/StyleTable.cs
+++ b/swig/csharp/ogr/StyleTable.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/ogr/ogr_wrap.cpp b/swig/csharp/ogr/ogr_wrap.cpp
index 5f699f5..2459d68 100644
--- a/swig/csharp/ogr/ogr_wrap.cpp
+++ b/swig/csharp/ogr/ogr_wrap.cpp
@@ -1,11 +1,11 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
- * 
- * This file is not intended to be easily readable and contains a number of 
+ * Version 2.0.12
+ *
+ * This file is not intended to be easily readable and contains a number of
  * coding conventions designed to improve portability and efficiency. Do not make
- * changes to this file unless you know what you are doing--modify the SWIG 
- * interface file instead. 
+ * changes to this file unless you know what you are doing--modify the SWIG
+ * interface file instead.
  * ----------------------------------------------------------------------------- */
 
 #define SWIGCSHARP
@@ -65,28 +65,28 @@ template <typename T> T SwigValueInit() {
 #ifndef SWIGUNUSED
 # if defined(__GNUC__)
 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#     define SWIGUNUSED __attribute__ ((__unused__))
 #   else
 #     define SWIGUNUSED
 #   endif
 # elif defined(__ICC)
-#   define SWIGUNUSED __attribute__ ((__unused__)) 
+#   define SWIGUNUSED __attribute__ ((__unused__))
 # else
-#   define SWIGUNUSED 
+#   define SWIGUNUSED
 # endif
 #endif
 
 #ifndef SWIG_MSC_UNSUPPRESS_4505
 # if defined(_MSC_VER)
 #   pragma warning(disable : 4505) /* unreferenced local function has been removed */
-# endif 
+# endif
 #endif
 
 #ifndef SWIGUNUSEDPARM
 # ifdef __cplusplus
 #   define SWIGUNUSEDPARM(p)
 # else
-#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
 # endif
 #endif
 
@@ -129,7 +129,7 @@ template <typename T> T SwigValueInit() {
 #   define SWIGSTDCALL __stdcall
 # else
 #   define SWIGSTDCALL
-# endif 
+# endif
 #endif
 
 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
@@ -280,18 +280,18 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterStringCallback_Ogr(SWIG_CSharpStringHelp
 #define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentOutOfRangeException, msg, ""); return nullreturn; } else
 
 /*  Errors in SWIG */
-#define  SWIG_UnknownError    	   -1 
-#define  SWIG_IOError        	   -2 
-#define  SWIG_RuntimeError   	   -3 
-#define  SWIG_IndexError     	   -4 
-#define  SWIG_TypeError      	   -5 
-#define  SWIG_DivisionByZero 	   -6 
-#define  SWIG_OverflowError  	   -7 
-#define  SWIG_SyntaxError    	   -8 
-#define  SWIG_ValueError     	   -9 
+#define  SWIG_UnknownError    	   -1
+#define  SWIG_IOError        	   -2
+#define  SWIG_RuntimeError   	   -3
+#define  SWIG_IndexError     	   -4
+#define  SWIG_TypeError      	   -5
+#define  SWIG_DivisionByZero 	   -6
+#define  SWIG_OverflowError  	   -7
+#define  SWIG_SyntaxError    	   -8
+#define  SWIG_ValueError     	   -9
 #define  SWIG_SystemError    	   -10
 #define  SWIG_AttributeError 	   -11
-#define  SWIG_MemoryError    	   -12 
+#define  SWIG_MemoryError    	   -12
 #define  SWIG_NullReferenceError   -13
 
 
diff --git a/swig/csharp/ogr/osr_wrap.cpp b/swig/csharp/ogr/osr_wrap.cpp
index 4f5087e..b9396cf 100644
--- a/swig/csharp/ogr/osr_wrap.cpp
+++ b/swig/csharp/ogr/osr_wrap.cpp
@@ -1,11 +1,11 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
- * 
- * This file is not intended to be easily readable and contains a number of 
+ * Version 2.0.12
+ *
+ * This file is not intended to be easily readable and contains a number of
  * coding conventions designed to improve portability and efficiency. Do not make
- * changes to this file unless you know what you are doing--modify the SWIG 
- * interface file instead. 
+ * changes to this file unless you know what you are doing--modify the SWIG
+ * interface file instead.
  * ----------------------------------------------------------------------------- */
 
 #define SWIGCSHARP
@@ -65,28 +65,28 @@ template <typename T> T SwigValueInit() {
 #ifndef SWIGUNUSED
 # if defined(__GNUC__)
 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#     define SWIGUNUSED __attribute__ ((__unused__))
 #   else
 #     define SWIGUNUSED
 #   endif
 # elif defined(__ICC)
-#   define SWIGUNUSED __attribute__ ((__unused__)) 
+#   define SWIGUNUSED __attribute__ ((__unused__))
 # else
-#   define SWIGUNUSED 
+#   define SWIGUNUSED
 # endif
 #endif
 
 #ifndef SWIG_MSC_UNSUPPRESS_4505
 # if defined(_MSC_VER)
 #   pragma warning(disable : 4505) /* unreferenced local function has been removed */
-# endif 
+# endif
 #endif
 
 #ifndef SWIGUNUSEDPARM
 # ifdef __cplusplus
 #   define SWIGUNUSEDPARM(p)
 # else
-#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
 # endif
 #endif
 
@@ -129,7 +129,7 @@ template <typename T> T SwigValueInit() {
 #   define SWIGSTDCALL __stdcall
 # else
 #   define SWIGSTDCALL
-# endif 
+# endif
 #endif
 
 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
@@ -280,18 +280,18 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterStringCallback_Osr(SWIG_CSharpStringHelp
 #define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentOutOfRangeException, msg, ""); return nullreturn; } else
 
 /*  Errors in SWIG */
-#define  SWIG_UnknownError    	   -1 
-#define  SWIG_IOError        	   -2 
-#define  SWIG_RuntimeError   	   -3 
-#define  SWIG_IndexError     	   -4 
-#define  SWIG_TypeError      	   -5 
-#define  SWIG_DivisionByZero 	   -6 
-#define  SWIG_OverflowError  	   -7 
-#define  SWIG_SyntaxError    	   -8 
-#define  SWIG_ValueError     	   -9 
+#define  SWIG_UnknownError    	   -1
+#define  SWIG_IOError        	   -2
+#define  SWIG_RuntimeError   	   -3
+#define  SWIG_IndexError     	   -4
+#define  SWIG_TypeError      	   -5
+#define  SWIG_DivisionByZero 	   -6
+#define  SWIG_OverflowError  	   -7
+#define  SWIG_SyntaxError    	   -8
+#define  SWIG_ValueError     	   -9
 #define  SWIG_SystemError    	   -10
 #define  SWIG_AttributeError 	   -11
-#define  SWIG_MemoryError    	   -12 
+#define  SWIG_MemoryError    	   -12
 #define  SWIG_NullReferenceError   -13
 
 
diff --git a/swig/csharp/ogr/wkbByteOrder.cs b/swig/csharp/ogr/wkbByteOrder.cs
index 2cf1a72..f9a4575 100644
--- a/swig/csharp/ogr/wkbByteOrder.cs
+++ b/swig/csharp/ogr/wkbByteOrder.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/ogr/wkbGeometryType.cs b/swig/csharp/ogr/wkbGeometryType.cs
index 2b88c48..3991fb9 100644
--- a/swig/csharp/ogr/wkbGeometryType.cs
+++ b/swig/csharp/ogr/wkbGeometryType.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/osr/CoordinateTransformation.cs b/swig/csharp/osr/CoordinateTransformation.cs
index 0bf88ae..3830d67 100644
--- a/swig/csharp/osr/CoordinateTransformation.cs
+++ b/swig/csharp/osr/CoordinateTransformation.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/osr/Osr.cs b/swig/csharp/osr/Osr.cs
index 21ba2c5..e498927 100644
--- a/swig/csharp/osr/Osr.cs
+++ b/swig/csharp/osr/Osr.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/osr/OsrPINVOKE.cs b/swig/csharp/osr/OsrPINVOKE.cs
index 9be4de7..e9e8a78 100644
--- a/swig/csharp/osr/OsrPINVOKE.cs
+++ b/swig/csharp/osr/OsrPINVOKE.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/osr/SpatialReference.cs b/swig/csharp/osr/SpatialReference.cs
index ae1b4b1..d88176f 100644
--- a/swig/csharp/osr/SpatialReference.cs
+++ b/swig/csharp/osr/SpatialReference.cs
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.12
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
diff --git a/swig/csharp/osr/osr_wrap.cpp b/swig/csharp/osr/osr_wrap.cpp
index 4f5087e..b9396cf 100644
--- a/swig/csharp/osr/osr_wrap.cpp
+++ b/swig/csharp/osr/osr_wrap.cpp
@@ -1,11 +1,11 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
- * 
- * This file is not intended to be easily readable and contains a number of 
+ * Version 2.0.12
+ *
+ * This file is not intended to be easily readable and contains a number of
  * coding conventions designed to improve portability and efficiency. Do not make
- * changes to this file unless you know what you are doing--modify the SWIG 
- * interface file instead. 
+ * changes to this file unless you know what you are doing--modify the SWIG
+ * interface file instead.
  * ----------------------------------------------------------------------------- */
 
 #define SWIGCSHARP
@@ -65,28 +65,28 @@ template <typename T> T SwigValueInit() {
 #ifndef SWIGUNUSED
 # if defined(__GNUC__)
 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#     define SWIGUNUSED __attribute__ ((__unused__))
 #   else
 #     define SWIGUNUSED
 #   endif
 # elif defined(__ICC)
-#   define SWIGUNUSED __attribute__ ((__unused__)) 
+#   define SWIGUNUSED __attribute__ ((__unused__))
 # else
-#   define SWIGUNUSED 
+#   define SWIGUNUSED
 # endif
 #endif
 
 #ifndef SWIG_MSC_UNSUPPRESS_4505
 # if defined(_MSC_VER)
 #   pragma warning(disable : 4505) /* unreferenced local function has been removed */
-# endif 
+# endif
 #endif
 
 #ifndef SWIGUNUSEDPARM
 # ifdef __cplusplus
 #   define SWIGUNUSEDPARM(p)
 # else
-#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
 # endif
 #endif
 
@@ -129,7 +129,7 @@ template <typename T> T SwigValueInit() {
 #   define SWIGSTDCALL __stdcall
 # else
 #   define SWIGSTDCALL
-# endif 
+# endif
 #endif
 
 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
@@ -280,18 +280,18 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterStringCallback_Osr(SWIG_CSharpStringHelp
 #define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentOutOfRangeException, msg, ""); return nullreturn; } else
 
 /*  Errors in SWIG */
-#define  SWIG_UnknownError    	   -1 
-#define  SWIG_IOError        	   -2 
-#define  SWIG_RuntimeError   	   -3 
-#define  SWIG_IndexError     	   -4 
-#define  SWIG_TypeError      	   -5 
-#define  SWIG_DivisionByZero 	   -6 
-#define  SWIG_OverflowError  	   -7 
-#define  SWIG_SyntaxError    	   -8 
-#define  SWIG_ValueError     	   -9 
+#define  SWIG_UnknownError    	   -1
+#define  SWIG_IOError        	   -2
+#define  SWIG_RuntimeError   	   -3
+#define  SWIG_IndexError     	   -4
+#define  SWIG_TypeError      	   -5
+#define  SWIG_DivisionByZero 	   -6
+#define  SWIG_OverflowError  	   -7
+#define  SWIG_SyntaxError    	   -8
+#define  SWIG_ValueError     	   -9
 #define  SWIG_SystemError    	   -10
 #define  SWIG_AttributeError 	   -11
-#define  SWIG_MemoryError    	   -12 
+#define  SWIG_MemoryError    	   -12
 #define  SWIG_NullReferenceError   -13
 
 
diff --git a/swig/include/perl/gdal_perl.i b/swig/include/perl/gdal_perl.i
index 97a6dab..35270a8 100644
--- a/swig/include/perl/gdal_perl.i
+++ b/swig/include/perl/gdal_perl.i
@@ -130,8 +130,8 @@ use Geo::OSR;
 # For GDAL 2.0 or above, GDAL X.Y.Z should then
 # VERSION = X + Y / 100.0 + Z / 10000.0
 
-our $VERSION = '2.0001';
-our $GDAL_VERSION = '2.0.1';
+our $VERSION = '2.0002';
+our $GDAL_VERSION = '2.0.2';
 
 =pod
 
diff --git a/swig/include/perl/ogr_perl.i b/swig/include/perl/ogr_perl.i
index 3b90c16..26e7cfe 100644
--- a/swig/include/perl/ogr_perl.i
+++ b/swig/include/perl/ogr_perl.i
@@ -131,7 +131,7 @@ ALTERED_DESTROY(OGRGeometryShadow, OGRc, delete_Geometry)
 %perlcode %{
 
 package Geo::OGR;
-our $VERSION = '2.0001'; # this needs to be the same as that in gdal_perl.i
+our $VERSION = '2.0002'; # this needs to be the same as that in gdal_perl.i
 
 package Geo::OGR::Driver;
 use strict;
@@ -781,16 +781,20 @@ use Encode;
 use Scalar::Util 'blessed';
 %}
 
-%feature("shadow") OGRFeatureShadow()
+%feature("shadow") OGRFeatureShadow( OGRFeatureDefnShadow *feature_def )
 %{
 use Carp;
 sub new {
     my $pkg = shift;
-    if (blessed($_[0]) and $_[0]->isa('Geo::OGR::FeatureDefn')) {
-        return $pkg->new($_[0]);
+    my $arg = blessed($_[0]);
+    my $defn;
+    if ($arg && $arg eq 'Geo::OGR::FeatureDefn') {
+        $defn = $_[0];
     } else {
-        return $pkg->new(Geo::OGR::FeatureDefn->new(@_));
+        $defn = Geo::OGR::FeatureDefn->new(@_);
     }
+    my $self = Geo::OGRc::new_Feature($defn);
+    bless $self, $pkg if defined($self);
 }
 %}
 
diff --git a/swig/java/GNUmakefile b/swig/java/GNUmakefile
index 2a500cc..28a7573 100644
--- a/swig/java/GNUmakefile
+++ b/swig/java/GNUmakefile
@@ -100,10 +100,10 @@ $(JAVA_MODULES): lib%jni.$(SO_EXT): %_wrap.$(OBJ_EXT)
 # Do not remove -fno-strict-aliasing while SWIG generates weird code in upcast methods
 # See http://trac.osgeo.org/gdal/changeset/16006
 %.$(OBJ_EXT): %.cpp
-	$(CXX) -fno-strict-aliasing $(CFLAGS) $(GDAL_INCLUDE) $(JAVA_INCLUDE) -c $<
+	$(CXX) -fno-strict-aliasing $(GDAL_INCLUDE) $(CFLAGS) $(CPPFLAGS) $(JAVA_INCLUDE) -c $<
 
 %.$(OBJ_EXT): %.cxx
-	$(CXX) -fno-strict-aliasing $(CFLAGS) $(GDAL_INCLUDE) $(JAVA_INCLUDE) -c $<
+	$(CXX) -fno-strict-aliasing $(GDAL_INCLUDE) $(CFLAGS) $(CPPFLAGS) $(JAVA_INCLUDE) -c $<
 
 %.$(OBJ_EXT): %.c
-	$(CC) -fno-strict-aliasing $(CFLAGS) $(GDAL_INCLUDE) $(JAVA_INCLUDE) -c $<
+	$(CC) -fno-strict-aliasing $(GDAL_INCLUDE) $(CFLAGS) $(CPPFLAGS) $(JAVA_INCLUDE) -c $<
diff --git a/swig/perl/MANIFEST b/swig/perl/MANIFEST
index 45e0cf9..b2507f1 100644
--- a/swig/perl/MANIFEST
+++ b/swig/perl/MANIFEST
@@ -17,6 +17,7 @@ t/02.t
 t/03.t
 t/gdal.t
 t/ogr.t
+t/osr.t
 Makefile.PL
 gdalconst_wrap.c
 gdal_wrap.cpp
@@ -32,5 +33,3 @@ transform.dox
 check_dox.pl
 parse-for-doxygen.pl
 Changes-in-the-API-in-2.0
-META.yml
-META.json
diff --git a/swig/perl/Makefile.PL b/swig/perl/Makefile.PL
index 5fba3b9..ac6bdd4 100644
--- a/swig/perl/Makefile.PL
+++ b/swig/perl/Makefile.PL
@@ -1,5 +1,10 @@
+use strict;
+use warnings;
+use File::Basename;
 use ExtUtils::MakeMaker;
 use Config;
+use Cwd;
+#use File::ShareDir::Install;
 
 # pick up our parameters from @ARGV
 my %ARGV;
@@ -9,132 +14,195 @@ for (@ARGV) {
     } else {
         $ARGV{$_} = 1;
     }
+    $_ = '' if /^--gdal-source-tree/;
     $_ = '' if /^--gdal-config/;
     $_ = '' if /^--no-version-check/;
+    $_ = '' if /^--no-downloads/;
+    print STDERR "Warning: unknown parameter: '$_'.\n" if $_;
 }
 # ... or from the environment
+$ARGV{'--gdal-source-tree'} = $ENV{PERL_GDAL_SOURCE_TREE} if $ENV{PERL_GDAL_SOURCE_TREE};
 $ARGV{'--gdal-config'} = $ENV{PERL_GDAL_CONFIG} if $ENV{PERL_GDAL_CONFIG};
 $ARGV{'--no-version-check'} = 1 if $ENV{PERL_GDAL_NO_VERSION_CHECK};
+$ARGV{'--no-downloads'} = 1 if $ENV{PERL_GDAL_NO_DOWNLOADS};
+
+if ($ARGV{'--help'}) {
+    print <<end;
+'perl Makefile.pl' configures this package to many kinds of systems.
+
+Usage: perl Makefile.pl [OPTION]
+
+To assign environment variables, specify them as VAR=VALUE.
+
+Control the GDAL that this module is built against:
+
+  --gdal-source-tree=PATH  use PATH as the gdal source
+    the same as environment variable PERL_GDAL_SOURCE_TREE=PATH
+
+  --gdal-config=PATH  use PATH as the gdal-config
+    the same as environment variable PERL_GDAL_CONFIG=PATH
+
+  --no-version-check  allow building against GDAL with different version
+    the same as setting environment variable PERL_GDAL_NO_VERSION_CHECK=1
+
+  --no-downloads      disable fetching GDAL source code as a last resort
+    the same as setting environment variable PERL_GDAL_NO_DOWNLOADS=1
+
+More information is available at ExtUtils-MakeMaker documentation.
+
+end
+exit;
+}
+
+my $source_tree;
+if ($ARGV{'--gdal-source-tree'}) {
+    $source_tree = $ARGV{'--gdal-source-tree'};
+    die "Path '$source_tree' does not exist." unless -e $source_tree && -d $source_tree;
+}
+elsif (-r '../../GDALmake.opt.in') {
+    $source_tree = '../..';
+    print "Building in source tree.\n" if $source_tree;
+}
+
+# Obtain the version of GDAL for this module distribution.
+
+my $my_gdal_version;
+if (open(my $fh, "lib/Geo/GDAL.pm")) {
+    for (<$fh>) {
+        ($my_gdal_version) = /(\d+\.\d+\.\d+)/ if /GDAL_VERSION/;
+    }
+    close $fh;
+} else {
+    die "GDAL Perl modules not found, perhaps you need to run make generate?";
+}
 
 # search and decide which GDAL (gdal-config) to build against if not given
 
+my $versions_may_differ = $ARGV{'--no-version-check'};
+my $downloads_are_ok = !$source_tree && !$ARGV{'--no-downloads'};
+my $gdal_config;
+if ($source_tree) {
+    $gdal_config = "$source_tree/apps/gdal-config";
+    die "There is no gdal-config in '$source_tree'.\n".
+        "You have to first say \"cd $source_tree; make\"." unless -r $gdal_config;
+}
+elsif ($ARGV{'--gdal-config'}) {
+    $gdal_config = $ARGV{'--gdal-config'};
+}
 my $config;
-if ($ARGV{'--gdal-config'}) {
-    if (-r $ARGV{'--gdal-config'}) {
-        $config = $ARGV{'--gdal-config'};
+if ($gdal_config) {
+    if (-r $gdal_config) {
+        $config = $gdal_config;
     } else {
-        print STDERR "The given gdal-config '$ARGV{'--gdal-config'}' does not exist or is unreadable.\n";
+        die "The gdal-config '$gdal_config' does not exist or is unreadable.\n";
     }
 } else {
     # scan known possible locations in the order of preference:
     my @configs;
-    for ('../../apps/gdal-config',
-         'c:/msys/1.0/local/bin/gdal-config',
+    for ('c:/msys/1.0/local/bin/gdal-config',
          '/usr/local/bin/gdal-config',
          '/usr/bin/gdal-config') {
         push @configs, $_ if -r $_;
     }
     if (@configs) {
         $config = $configs[0];
-        print "Found gdal-config(s): '",join("', '", @configs),"'.\nWill use '$config'.\n";
+        if (@configs) {
+            print "Found gdal-config(s): '",join("', '", @configs),"'.\n";
+            print "Will try '$config'.\n";
+        } else {
+            print STDERR "Did not find any gdal-config(s)\n";
+        }
     }
 }
-die "Can't find gdal-config. Please install GDAL development files or\n".
-    "define the location of gdal-config using --gdal-config=XXX\n".
-    "or with environment variable PERL_GDAL_CONFIG." unless $config;
 
-# Obtain GDAL version, libs, and inc. We will assume gdal-config is not
-# excutable if we're in a GDAL distro tree or on Windows.
+if (!$config && $downloads_are_ok) {
+    $source_tree = download_and_compile_gdal($my_gdal_version);
+    $config = "$source_tree/apps/gdal-config";
+}
+
+my $uri = gdal_source_location($my_gdal_version);
 
-my $gdal_version;
-my $LIB = '';
-my $INC = '';
-if ($config eq '../../apps/gdal-config' or $config eq 'c:/msys/1.0/local/bin/gdal-config') { 
-    if ($config eq '../../apps/gdal-config') {
-        print "Building against GDAL in this distro tree\n";
-        $LIB .= '-L../../.libs -L../.. ';
-    } else {
-        print "Building against GDAL in 'c:/msys/1.0/local/bin/'\n";
-        $LIB .= '-Lc:/msys/1.0/local/lib ';
-        $INC .= '-Ic:/msys/1.0/local/include ';
-    }
-    my $fh;
-    if (open($fh, $config)) {
-        for (<$fh>) {
-            ($gdal_version) = /(\d+\.\d+\.\d+)/ if /^CONFIG_VERSION/;
-            if (/^CONFIG_LIBS/) {
-                s/^CONFIG_LIBS="//;
-                s/"\s*$//;
-                if ($_ =~ /\.la$/) { 
-                    # parse a libtool library file
-                    $LIB .= parse_libtool_library_file_for_l($_);
-                } else {
-                    $LIB .= $_;
-                }
-                $LIB .= ' ';
-            }
-            if (/^CONFIG_DEP_LIBS/) {
-                s/^CONFIG_DEP_LIBS="//;
-                s/"\s*$//;
-                $LIB .= $_;
-            }
-            if (/^CONFIG_CFLAGS/) {
-                s/^CONFIG_CFLAGS="//;
-                s/"\s*$//;
-                $INC .= $_;
-            }
-        }
-        close $fh;
-    }
-} else {
-    print "Building against GDAL defined by '$config'.\n";
-    chomp($gdal_version = `$config --version`);
-    chomp($LIB = `$config --libs`);
-    chomp($INC = `$config --cflags`);
+my $gdal_version = get_gdal_version($config);
+my $different_versions = $my_gdal_version ne $gdal_version;
+
+my $msg = <<end;
+
+The version of the GDAL development files you spefied is different
+from the version these bindings were developed for (I have
+$my_gdal_version and $config has $gdal_version). 
+You can either
+
+- get GDAL development files from $uri or from whereever you get
+  development files for your system,
+
+- specify another gdal-config,
+
+- allow building against a different version of GDAL development files
+  (with --no-version-check or by setting the environment variable
+  PERL_GDAL_NO_VERSION_CHECK to a true value) - this is however not
+  recommended, or
+
+- let me download and build GDAL for you. It will happen automatically
+  if you clear the command line and remove environment variables that
+  may prevent it (see --help).
+
+end
+
+die $msg if ($gdal_config && $different_versions && !$versions_may_differ) ||
+    (!$downloads_are_ok && $different_versions && !$versions_may_differ);
+
+if ($different_versions && !$gdal_config && !$versions_may_differ && $downloads_are_ok) {
+    $source_tree = download_and_compile_gdal($my_gdal_version, $gdal_version);
+    $config = "$source_tree/apps/gdal-config";
 }
 
-# Obtain our version.
+# still in the game?
 
-my $pm_version;
-if (open($fh, "lib/Geo/GDAL.pm")) {
-    for (<$fh>) {
-        ($pm_version) = /(\d+\.\d+\.\d+)/ if /GDAL_VERSION/;
-    }
-    close $fh;
-} else {
-    die "GDAL Perl modules not found, perhaps you need to run make generate?";
+my $have_gnm = `grep "CONFIG_GNM_ENABLED" $config`;
+my $have_ogr = `grep "CONFIG_OGR_ENABLED" $config`;
+for ($have_gnm, $have_ogr) {
+    chomp;
+    $_ = /yes/ ? 1 : 0;
 }
 
-die "=======================================================\n".
-    "PLEASE NOTE!\n".
-    "The GDAL that you try to build against has version\n".
-    "$gdal_version and this module was released from version\n".
-    "$pm_version. These do not match. Building against different\n".
-    "version may work but you need to remove this check first.\n".
-    "You can pass by this warning with --no-version-check\n".
-    "or by setting the environment variable PERL_GDAL_NO_VERSION_CHECK\n".
-    "to a true value (for example 1).\n".
-    "Thank you.\n".
-    "=======================================================\n"
-    if ($gdal_version ne $pm_version) and !$ARGV{'--no-version-check'};
-
-%object = ( 'Geo::GDAL' => 'gdal_wrap.o',
-            'Geo::GDAL::Const' => 'gdalconst_wrap.o',
-            'Geo::OGR' => 'ogr_wrap.o',
-            'Geo::OSR' => 'osr_wrap.o' );
+my ($INC, $LIB) = get_gdal_inc_lib($config);
+
+my %object = ( 'Geo::GDAL' => 'gdal_wrap.o',
+               'Geo::GDAL::Const' => 'gdalconst_wrap.o',
+               'Geo::OSR' => 'osr_wrap.o' );
+
+$object{'Geo::OGR'} = 'ogr_wrap.o' if $have_ogr;
+$object{'Geo::GNM'} = 'gnm_wrap.o' if $have_gnm;
 
 if ($ARGV{'--debug'}) {
     print "LIB = $LIB\n";
     print "INC = $INC\n";
 }
 
-for my $module (keys %object) {
+#install_share 'share';
+#store_datadir_for_tests($source_tree, $config);
+
+for my $module (sort keys %object) {
     my $add = $module;
     $add =~ s/:/_/g;
+    my $LD = $Config{ld};
+    $LD .= ' '.$ENV{CFLAGS} if $ENV{CFLAGS};
+    $LD .= ' '.$ENV{LDFLAGS} if $ENV{LDFLAGS};
+    my $OPTIMIZE = '';
+    $OPTIMIZE .= ' '.$ENV{CFLAGS} if $ENV{CFLAGS};
+    $OPTIMIZE .= ' '.$ENV{CPPFLAGS} if $ENV{CFLAGS};
+    
+    my %PM = ( 'lib/Geo/GDAL.pm' => '$(INST_LIBDIR)/GDAL.pm',
+               'lib/Geo/OSR.pm' => '$(INST_LIBDIR)/OSR.pm',
+               'lib/Geo/GDAL/Const.pm' => '$(INST_LIBDIR)/GDAL/Const.pm' );
+    
+    $PM{'lib/Geo/OGR.pm'} = '$(INST_LIBDIR)/OGR.pm' if $have_ogr;
+    $PM{'lib/Geo/GNM.pm'} = '$(INST_LIBDIR)/GNM.pm' if $have_gnm;
+
     WriteMakefile( NAME => $module,
                    VERSION_FROM => 'lib/Geo/GDAL.pm',
                    ABSTRACT_FROM => 'lib/Geo/GDAL.pm',
-                   AUTHOR => 'Ari Jolma <https://trac.osgeo.org/gdal/wiki/GdalOgrInPerl>',
+                   AUTHOR => 'Ari Jolma <ari.jolma at gmail.com>',
                    LICENSE => 'mit',
                    META_MERGE => {
                        'meta-spec' => { version => 2 },
@@ -149,16 +217,231 @@ for my $module (keys %object) {
                    MAKEFILE => 'Makefile_'.$add,
                    LIBS => $LIB,
                    INC => $INC,
-                   OPTIMIZE => "$ENV{CFLAGS} $ENV{CPPFLAGS}",
-                   LD => "$Config{ld} $ENV{CFLAGS} $ENV{LDFLAGS}",
+                   OPTIMIZE => $OPTIMIZE,
+                   LD => $LD,
                    OBJECT => $object{$module},
-                   PM => {'lib/Geo/GDAL.pm' => '$(INST_LIBDIR)/GDAL.pm',
-                          'lib/Geo/OGR.pm' => '$(INST_LIBDIR)/OGR.pm',
-                          'lib/Geo/OSR.pm' => '$(INST_LIBDIR)/OSR.pm',
-                          'lib/Geo/GDAL/Const.pm' => '$(INST_LIBDIR)/GDAL/Const.pm'}
+                   PM => \%PM,
+                   CONFIGURE_REQUIRES => {
+                       'strict' => 0,
+                       'warnings' => 0,
+                       'File::Basename' => 0,
+                       'ExtUtils::MakeMaker' => 0,
+                       'Config' => 0,
+                       'Cwd' => 0,
+#                       'File::Fetch' => 0,
+#                       'Capture::Tiny' => 0,
+#                       'File::ShareDir::Install' => 0 
+                   },
+                   BUILD_REQUIRES => {
+                       'strict' => 0,
+                       'warnings' => 0,
+                       'File::Basename' => 0,
+                       'ExtUtils::MakeMaker' => 0,
+                       'Config' => 0,
+                       'Cwd' => 0,
+#                       'File::Fetch' => 0,
+#                       'Capture::Tiny' => 0,
+#                       'File::ShareDir::Install' => 0 
+                   },
+                   PREREQ_PM => {
+                       Carp => 0,
+                       Encode => 0,
+                       'Scalar::Util' => 0,
+                       POSIX => 0 },
+                   TEST_REQUIRES => {
+                       'Scalar::Util' => 0,
+#                       'File::Share' => 0,
+                       'Test::More' => 0 },
         );
 }
 
+sub gdal_source_location {
+    my $version = shift;
+    return "http://download.osgeo.org/gdal/$version/gdal-$version.tar.gz";
+}
+
+sub download_and_compile_gdal {
+    my ($version, $got_version) = @_;
+    
+    if (not defined $got_version) {
+        print STDERR <<end;
+
+I did not find GDAL development files. I am going to try to download
+and compile GDAL for you. You can prevent this happening by a command
+line argument --no-downloads or by setting the environment variable
+PERL_GDAL_NO_DOWNLOADS to a true value, or by specifying a good
+gdal-config with --gdal-config or the environment variable
+PERL_GDAL_CONFIG. If the version of the GDAL development files is
+different from what I have (it is $version) I will be back here.
+end
+
+    } else {
+        print STDERR <<end;
+
+The GDAL development files you gave or I found have a different
+version ($got_version) than what these bindings were developed for
+($version). I am going to try to download and compile GDAL for you.
+You can prevent this happening by pointing me to good GDAL development
+files, with a command line argument --no-downloads or by setting the
+environment variable PERL_GDAL_NO_DOWNLOADS to a true value, or by
+being adventurous by specifying --no-version-check or setting the
+environment variable PERL_GDAL_NO_VERSION_CHECK.
+end
+
+}
+    print STDERR <<end;
+
+Note that this automatic download and compile is mostly meant for
+automatic tests etc. It is recommended that you download and configure
+GDAL by hand. This may take a very long time. I will capture the
+output from the build and put it into gdal-build.log and
+gdal-build.err. You can look into them while this goes on but the
+output will be buffered.
+
+end
+
+{ 
+    require File::Fetch;
+    require Capture::Tiny;
+    Capture::Tiny->import(':all');
+    my $pwd = cwd();
+    open(my $log, ">", "gdal-build.log") 
+        or die "Can't open gdal-build.log: $!.";
+    open(my $err, ">", "gdal-build.err") 
+        or die "Can't open gdal-build.err: $!.";
+
+    my $step = sub {
+        my @cmd = @_;
+        my $ret;
+        print "@cmd\n";
+        my $code = sub {
+            if ($cmd[0] eq 'cd') {
+                $ret = chdir($cmd[1]);
+            } else {
+                $ret = system(@cmd);
+            }
+        };
+        my ($stdout, $stderr, $exit) = capture($code);
+        print $err $stderr;
+        print $log $stdout;
+        return $cmd[0] eq 'cd' ? $ret : ($ret == 0);
+    };
+
+    my $gdal = "gdal-$version";
+    my $uri = gdal_source_location($version);
+    my $ok = 1;
+    
+    print "get GDAL version $version\n";
+    my $code = sub {
+        if ($version eq '2.0.0' or $version eq '2.0.1') {
+            print "$version is buggy, get latest from 2.0 branch.\n";
+            $ok = $step->("svn", "checkout", "https://svn.osgeo.org/gdal/branches/2.0/gdal", "gdal");
+            $gdal = "gdal";
+        } 
+        elsif (-r "gdal-$version.tar.gz" and -s "gdal-$version.tar.gz") { # fetch leaves a zero sized file even when it fails
+            print "Using existing \"$gdal.tar.gz\"\n";
+            $ok = $step->("tar", "zxf", "$gdal.tar.gz");
+        }
+        else {
+            print "Attempting to fetch '$uri'\n";
+            my $ff = File::Fetch->new(uri => $uri);
+            $ok = $ff->fetch() if $ff;
+            if ($ok) {
+                $ok = $step->("tar", "zxf", "$gdal.tar.gz");
+            } else {
+                print "No luck. Maybe this is the development version?\n";
+                $ok = $step->("svn", "checkout", "https://svn.osgeo.org/gdal/trunk/gdal", "gdal");
+                $gdal = "gdal";
+            }
+        }
+    };
+    my ($stdout, $stderr, $exit) = capture($code);
+    print $err $stderr;
+    print $log $stdout;
+    if ($ok) {
+        for my $cmd (["cd", $gdal],
+                     ["./configure"],
+                     [($^O =~ /bsd/i ? "gmake" : "make"), "-j4"],
+                     ["cd", ".."]) 
+        {
+            $ok = $step->(@$cmd);
+            last unless $ok;
+        }
+    }
+    close $log;
+    close $err;
+    return "./$gdal" if $ok;
+    chdir($pwd);
+    open($err, "<", "gdal-build.err") 
+        or die "Can't open gdal-build.err: $!.";
+    my @err = <$err>;
+    close $err;
+    die "Downloading and compiling of GDAL failed.\n".
+        "The error is probably explained by the error log.\n".
+        "It is '$pwd/gdal-build.err'.\n".
+        "@err\n";
+}}
+
+sub get_gdal_version {
+    my $config = shift;
+    my $version;
+    if (-x $config) {
+        chomp($version = `$config --version`);
+    }
+    else {
+        if (open(my $fh, $config) || die "Can't open '$config': $!") {
+            for (<$fh>) {
+                ($version) = /(\d+\.\d+\.\d+)/ if /^CONFIG_VERSION/;
+            }
+            close $fh;
+        }
+        die "Can't find version from '$config'." unless $version;
+    }
+    return $version;
+}
+
+sub get_gdal_inc_lib {
+    my $config = shift;
+    my ($INC, $LIB) = ('', '');
+    if ($source_tree) {
+        $LIB = "-L$source_tree/.libs -L$source_tree -lgdal ";
+        chomp($INC = `$config --cflags`);
+        $INC .= " -I$source_tree/gnm " if $have_gnm;
+    }
+    elsif (-x $config) {
+        chomp($INC = `$config --cflags`);
+        chomp($LIB = `$config --libs`);
+    }
+    else {
+        if (open(my $fh, $config) || die "Can't open '$config': $!") {
+            for (<$fh>) {
+                if (/^CONFIG_LIBS/) {
+                    s/^CONFIG_LIBS="//;
+                    s/"\s*$//;
+                    if ($_ =~ /\.la$/) { 
+                        $LIB .= parse_libtool_library_file_for_l($_);
+                    } else {
+                        $LIB .= $_;
+                    }
+                    $LIB .= ' ';
+                }
+                if (/^CONFIG_DEP_LIBS/) {
+                    s/^CONFIG_DEP_LIBS="//;
+                    s/"\s*$//;
+                    $LIB .= $_;
+                }
+                if (/^CONFIG_CFLAGS/) {
+                    s/^CONFIG_CFLAGS="//;
+                    s/"\s*$//;
+                    $INC .= $_;
+                }
+            }
+            close $fh;
+        }
+    }
+    return ($INC, $LIB);
+}
+
 sub parse_libtool_library_file_for_l {
     my $fn = shift;
     my $fh;
@@ -177,3 +460,24 @@ sub parse_libtool_library_file_for_l {
     }
     return $l;
 }
+
+sub store_datadir_for_tests {
+    my ($source_tree, $config) = @_;
+    open(my $fh, ">", "share/gdal-datadir") or die "cannot open > share/gdal-datadir: $!";
+    if ($source_tree) {
+        $source_tree = Cwd::abs_path($source_tree);
+        print $fh "$source_tree/data\n";
+    }
+    elsif (-x $config) {
+        my $datadir;
+        chomp($datadir = `$config --datadir`);
+        print $fh "$datadir\n";
+    }
+    else {
+        print STDERR "I could not set GDAL data directory. Expect problems with tests.\n";
+    }
+    close $fh;
+}
+
+#package MY;
+#use File::ShareDir::Install qw(postamble);
diff --git a/swig/perl/README b/swig/perl/README
index 8d76ad7..377ec19 100644
--- a/swig/perl/README
+++ b/swig/perl/README
@@ -14,9 +14,43 @@ from GDAL sources.
 
 This module is _not_ compatible with Geo::GDAL 0.11
 
-INSTALLATION
+INSTALLATION FROM CPAN DISTRIBUTION
 
-This module can be built and installed as a part of gdal build and
+When this module is installed from a CPAN distribution, it must first
+find GDAL development files. That is basically about finding the
+gdal-config script. You can specify gdal-config or you can let
+Makefile.PL search for it. However, this module is usually very
+specific about the version of the GDAL it can be built against. The
+branch needs to be the same.
+
+If gdal-config was not found or its version is not good and
+Makefile.PL had to look it by itself, Makefile.PL will try to download
+and build GDAL. That is mostly meant for automatic testing only.
+
+Control the GDAL that this module is built against:
+
+  --gdal-config=PATH  use PATH as the gdal-config
+    the same as environment variable PERL_GDAL_CONFIG=PATH
+
+  --no-version-check  allow building against GDAL with different version
+    the same as setting environment variable PERL_GDAL_NO_VERSION_CHECK=1
+
+  --no-downloads      disable fetching GDAL source code as a last resort
+    the same as setting environment variable PERL_GDAL_NO_DOWNLOADS=1
+
+More information about running Makefile.PL is available at
+ExtUtils-MakeMaker documentation.
+
+To build, test and install this module the basic steps are
+
+perl Makefile.PL
+make
+make test
+make install
+
+INSTALLATION FROM GDAL SOURCE TREE
+
+This module will be built and installed as a part of gdal build and
 installation, if you use --with-perl in configure of gdal. That
 process is controlled by GNUmakefile. 
 
diff --git a/swig/perl/gdal_wrap.cpp b/swig/perl/gdal_wrap.cpp
index 774509d..228620d 100644
--- a/swig/perl/gdal_wrap.cpp
+++ b/swig/perl/gdal_wrap.cpp
@@ -1,11 +1,11 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
- * 
- * This file is not intended to be easily readable and contains a number of 
+ * Version 2.0.12
+ *
+ * This file is not intended to be easily readable and contains a number of
  * coding conventions designed to improve portability and efficiency. Do not make
- * changes to this file unless you know what you are doing--modify the SWIG 
- * interface file instead. 
+ * changes to this file unless you know what you are doing--modify the SWIG
+ * interface file instead.
  * ----------------------------------------------------------------------------- */
 
 #define SWIGPERL
@@ -66,28 +66,28 @@ template <typename T> T SwigValueInit() {
 #ifndef SWIGUNUSED
 # if defined(__GNUC__)
 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#     define SWIGUNUSED __attribute__ ((__unused__))
 #   else
 #     define SWIGUNUSED
 #   endif
 # elif defined(__ICC)
-#   define SWIGUNUSED __attribute__ ((__unused__)) 
+#   define SWIGUNUSED __attribute__ ((__unused__))
 # else
-#   define SWIGUNUSED 
+#   define SWIGUNUSED
 # endif
 #endif
 
 #ifndef SWIG_MSC_UNSUPPRESS_4505
 # if defined(_MSC_VER)
 #   pragma warning(disable : 4505) /* unreferenced local function has been removed */
-# endif 
+# endif
 #endif
 
 #ifndef SWIGUNUSEDPARM
 # ifdef __cplusplus
 #   define SWIGUNUSEDPARM(p)
 # else
-#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
 # endif
 #endif
 
@@ -130,7 +130,7 @@ template <typename T> T SwigValueInit() {
 #   define SWIGSTDCALL __stdcall
 # else
 #   define SWIGSTDCALL
-# endif 
+# endif
 #endif
 
 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
@@ -168,7 +168,7 @@ template <typename T> T SwigValueInit() {
   You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
   creating a static or dynamic library from the SWIG runtime code.
   In 99.9% of the cases, SWIG just needs to declare them as 'static'.
-  
+
   But only do this if strictly necessary, ie, if you have problems
   with your compiler or suchlike.
 */
@@ -194,16 +194,16 @@ template <typename T> T SwigValueInit() {
 #define SWIG_POINTER_OWN           0x1
 
 
-/* 
+/*
    Flags/methods for returning states.
-   
-   The SWIG conversion methods, as ConvertPtr, return an integer 
+
+   The SWIG conversion methods, as ConvertPtr, return an integer
    that tells if the conversion was successful or not. And if not,
    an error code can be returned (see swigerrors.swg for the codes).
-   
+
    Use the following macros/flags to set or process the returning
    states.
-   
+
    In old versions of SWIG, code such as the following was usually written:
 
      if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
@@ -236,23 +236,23 @@ template <typename T> T SwigValueInit() {
     } else {
       // fail code
     }
-    
+
    I.e., now SWIG_ConvertPtr can return new objects and you can
    identify the case and take care of the deallocation. Of course that
    also requires SWIG_ConvertPtr to return new result values, such as
 
-      int SWIG_ConvertPtr(obj, ptr,...) {         
-        if (<obj is ok>) {			       
-          if (<need new object>) {		       
-            *ptr = <ptr to new allocated object>; 
-            return SWIG_NEWOBJ;		       
-          } else {				       
-            *ptr = <ptr to old object>;	       
-            return SWIG_OLDOBJ;		       
-          } 				       
-        } else {				       
-          return SWIG_BADOBJ;		       
-        }					       
+      int SWIG_ConvertPtr(obj, ptr,...) {
+        if (<obj is ok>) {
+          if (<need new object>) {
+            *ptr = <ptr to new allocated object>;
+            return SWIG_NEWOBJ;
+          } else {
+            *ptr = <ptr to old object>;
+            return SWIG_OLDOBJ;
+          }
+        } else {
+          return SWIG_BADOBJ;
+        }
       }
 
    Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
@@ -266,17 +266,17 @@ template <typename T> T SwigValueInit() {
        int fooi(int);
 
    and you call
- 
+
       food(1)   // cast rank '1'  (1 -> 1.0)
       fooi(1)   // cast rank '0'
 
    just use the SWIG_AddCast()/SWIG_CheckState()
 */
 
-#define SWIG_OK                    (0) 
+#define SWIG_OK                    (0)
 #define SWIG_ERROR                 (-1)
 #define SWIG_IsOK(r)               (r >= 0)
-#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  
+#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)
 
 /* The CastRankLimit says how many bits are used for the cast rank */
 #define SWIG_CASTRANKLIMIT         (1 << 8)
@@ -307,14 +307,14 @@ template <typename T> T SwigValueInit() {
 #  endif
 #  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
 #  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
-SWIGINTERNINLINE int SWIG_AddCast(int r) { 
+SWIGINTERNINLINE int SWIG_AddCast(int r) {
   return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
 }
-SWIGINTERNINLINE int SWIG_CheckState(int r) { 
-  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
+SWIGINTERNINLINE int SWIG_CheckState(int r) {
+  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
 }
 #else /* no cast-rank mode */
-#  define SWIG_AddCast
+#  define SWIG_AddCast(r) (r)
 #  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
 #endif
 
@@ -358,7 +358,7 @@ typedef struct swig_module_info {
   void                    *clientdata;		/* Language specific module data */
 } swig_module_info;
 
-/* 
+/*
   Compare two type names skipping the space characters, therefore
   "char*" == "char *" and "Class<int>" == "Class<int >", etc.
 
@@ -378,18 +378,18 @@ SWIG_TypeNameComp(const char *f1, const char *l1,
 
 /*
   Check type equivalence in a name list like <name1>|<name2>|...
-  Return 0 if not equal, 1 if equal
+  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
 */
 SWIGRUNTIME int
-SWIG_TypeEquiv(const char *nb, const char *tb) {
-  int equiv = 0;
+SWIG_TypeCmp(const char *nb, const char *tb) {
+  int equiv = 1;
   const char* te = tb + strlen(tb);
   const char* ne = nb;
-  while (!equiv && *ne) {
+  while (equiv != 0 && *ne) {
     for (nb = ne; *ne; ++ne) {
       if (*ne == '|') break;
     }
-    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    equiv = SWIG_TypeNameComp(nb, ne, tb, te);
     if (*ne) ++ne;
   }
   return equiv;
@@ -397,24 +397,13 @@ SWIG_TypeEquiv(const char *nb, const char *tb) {
 
 /*
   Check type equivalence in a name list like <name1>|<name2>|...
-  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
+  Return 0 if not equal, 1 if equal
 */
 SWIGRUNTIME int
-SWIG_TypeCompare(const char *nb, const char *tb) {
-  int equiv = 0;
-  const char* te = tb + strlen(tb);
-  const char* ne = nb;
-  while (!equiv && *ne) {
-    for (nb = ne; *ne; ++ne) {
-      if (*ne == '|') break;
-    }
-    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
-    if (*ne) ++ne;
-  }
-  return equiv;
+SWIG_TypeEquiv(const char *nb, const char *tb) {
+  return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
 }
 
-
 /*
   Check the typename
 */
@@ -442,7 +431,7 @@ SWIG_TypeCheck(const char *c, swig_type_info *ty) {
   return 0;
 }
 
-/* 
+/*
   Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
 */
 SWIGRUNTIME swig_cast_info *
@@ -477,7 +466,7 @@ SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
   return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
 }
 
-/* 
+/*
    Dynamic pointer casting. Down an inheritance hierarchy
 */
 SWIGRUNTIME swig_type_info *
@@ -521,7 +510,7 @@ SWIG_TypePrettyName(const swig_type_info *type) {
     return type->name;
 }
 
-/* 
+/*
    Set the clientdata field for a type
 */
 SWIGRUNTIME void
@@ -529,14 +518,14 @@ SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
   swig_cast_info *cast = ti->cast;
   /* if (ti->clientdata == clientdata) return; */
   ti->clientdata = clientdata;
-  
+
   while (cast) {
     if (!cast->converter) {
       swig_type_info *tc = cast->type;
       if (!tc->clientdata) {
 	SWIG_TypeClientData(tc, clientdata);
       }
-    }    
+    }
     cast = cast->next;
   }
 }
@@ -545,18 +534,18 @@ SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
   SWIG_TypeClientData(ti, clientdata);
   ti->owndata = 1;
 }
-  
+
 /*
   Search for a swig_type_info structure only by mangled name
   Search is a O(log #types)
-  
-  We start searching at module start, and finish searching when start == end.  
+
+  We start searching at module start, and finish searching when start == end.
   Note: if start == end at the beginning of the function, we go all the way around
   the circular list.
 */
 SWIGRUNTIME swig_type_info *
-SWIG_MangledTypeQueryModule(swig_module_info *start, 
-                            swig_module_info *end, 
+SWIG_MangledTypeQueryModule(swig_module_info *start,
+                            swig_module_info *end,
 		            const char *name) {
   swig_module_info *iter = start;
   do {
@@ -565,11 +554,11 @@ SWIG_MangledTypeQueryModule(swig_module_info *start,
       register size_t r = iter->size - 1;
       do {
 	/* since l+r >= 0, we can (>> 1) instead (/ 2) */
-	register size_t i = (l + r) >> 1; 
+	register size_t i = (l + r) >> 1;
 	const char *iname = iter->types[i]->name;
 	if (iname) {
 	  register int compare = strcmp(name, iname);
-	  if (compare == 0) {	    
+	  if (compare == 0) {
 	    return iter->types[i];
 	  } else if (compare < 0) {
 	    if (i) {
@@ -594,14 +583,14 @@ SWIG_MangledTypeQueryModule(swig_module_info *start,
   Search for a swig_type_info structure for either a mangled name or a human readable name.
   It first searches the mangled names of the types, which is a O(log #types)
   If a type is not found it then searches the human readable names, which is O(#types).
-  
-  We start searching at module start, and finish searching when start == end.  
+
+  We start searching at module start, and finish searching when start == end.
   Note: if start == end at the beginning of the function, we go all the way around
   the circular list.
 */
 SWIGRUNTIME swig_type_info *
-SWIG_TypeQueryModule(swig_module_info *start, 
-                     swig_module_info *end, 
+SWIG_TypeQueryModule(swig_module_info *start,
+                     swig_module_info *end,
 		     const char *name) {
   /* STEP 1: Search the name field using binary search */
   swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
@@ -620,12 +609,12 @@ SWIG_TypeQueryModule(swig_module_info *start,
       iter = iter->next;
     } while (iter != end);
   }
-  
+
   /* neither found a match */
   return 0;
 }
 
-/* 
+/*
    Pack binary data into a string
 */
 SWIGRUNTIME char *
@@ -641,7 +630,7 @@ SWIG_PackData(char *c, void *ptr, size_t sz) {
   return c;
 }
 
-/* 
+/*
    Unpack binary data from a string
 */
 SWIGRUNTIME const char *
@@ -655,21 +644,21 @@ SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
       uu = ((d - '0') << 4);
     else if ((d >= 'a') && (d <= 'f'))
       uu = ((d - ('a'-10)) << 4);
-    else 
+    else
       return (char *) 0;
     d = *(c++);
     if ((d >= '0') && (d <= '9'))
       uu |= (d - '0');
     else if ((d >= 'a') && (d <= 'f'))
       uu |= (d - ('a'-10));
-    else 
+    else
       return (char *) 0;
     *u = uu;
   }
   return c;
 }
 
-/* 
+/*
    Pack 'void *' into a string buffer.
 */
 SWIGRUNTIME char *
@@ -729,18 +718,18 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
 #endif
 
 /*  Errors in SWIG */
-#define  SWIG_UnknownError    	   -1 
-#define  SWIG_IOError        	   -2 
-#define  SWIG_RuntimeError   	   -3 
-#define  SWIG_IndexError     	   -4 
-#define  SWIG_TypeError      	   -5 
-#define  SWIG_DivisionByZero 	   -6 
-#define  SWIG_OverflowError  	   -7 
-#define  SWIG_SyntaxError    	   -8 
-#define  SWIG_ValueError     	   -9 
+#define  SWIG_UnknownError    	   -1
+#define  SWIG_IOError        	   -2
+#define  SWIG_RuntimeError   	   -3
+#define  SWIG_IndexError     	   -4
+#define  SWIG_TypeError      	   -5
+#define  SWIG_DivisionByZero 	   -6
+#define  SWIG_OverflowError  	   -7
+#define  SWIG_SyntaxError    	   -8
+#define  SWIG_ValueError     	   -9
 #define  SWIG_SystemError    	   -10
 #define  SWIG_AttributeError 	   -11
-#define  SWIG_MemoryError    	   -12 
+#define  SWIG_MemoryError    	   -12
 #define  SWIG_NullReferenceError   -13
 
 
@@ -925,7 +914,7 @@ SWIG_Perl_ErrorType(int code) {
 
 /* Runtime API */
 
-#define SWIG_GetModule(clientdata)                      SWIG_Perl_GetModule()
+#define SWIG_GetModule(clientdata)                      SWIG_Perl_GetModule(clientdata)
 #define SWIG_SetModule(clientdata, pointer)             SWIG_Perl_SetModule(pointer)
 
 
@@ -1362,7 +1351,7 @@ SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, i
 
 
 SWIGRUNTIME swig_module_info *
-SWIG_Perl_GetModule(void) {
+SWIG_Perl_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
   static void *type_pointer = (void *)0;
   SV *pointer;
 
@@ -1456,9 +1445,6 @@ SWIG_Perl_SetModule(swig_module_info *module) {
 #ifdef eof
   #undef eof
 #endif
-#ifdef bool
-  #undef bool
-#endif
 #ifdef close
   #undef close
 #endif
@@ -1499,6 +1485,14 @@ SWIG_Perl_SetModule(swig_module_info *module) {
   #undef stat
 #endif
 
+#ifdef bool
+  /* Leave if macro is from C99 stdbool.h */
+  #ifndef __bool_true_false_are_defined
+    #undef bool
+  #endif
+#endif
+
+
 
 
 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
@@ -1550,7 +1544,7 @@ static swig_module_info swig_module = {swig_types, 26, 0, 0, 0, 0};
 #define SWIG_name   "Geo::GDALc::boot_Geo__GDAL"
 #define SWIG_prefix "Geo::GDALc::"
 
-#define SWIGVERSION 0x020007 
+#define SWIGVERSION 0x020012 
 #define SWIG_VERSION SWIGVERSION
 
 
@@ -23198,18 +23192,18 @@ static swig_command_info swig_commands[] = {
 };
 /* -----------------------------------------------------------------------------
  * Type initialization:
- * This problem is tough by the requirement that no dynamic 
- * memory is used. Also, since swig_type_info structures store pointers to 
+ * This problem is tough by the requirement that no dynamic
+ * memory is used. Also, since swig_type_info structures store pointers to
  * swig_cast_info structures and swig_cast_info structures store pointers back
- * to swig_type_info structures, we need some lookup code at initialization. 
- * The idea is that swig generates all the structures that are needed. 
- * The runtime then collects these partially filled structures. 
- * The SWIG_InitializeModule function takes these initial arrays out of 
+ * to swig_type_info structures, we need some lookup code at initialization.
+ * The idea is that swig generates all the structures that are needed.
+ * The runtime then collects these partially filled structures.
+ * The SWIG_InitializeModule function takes these initial arrays out of
  * swig_module, and does all the lookup, filling in the swig_module.types
  * array with the correct data and linking the correct swig_cast_info
  * structures together.
  *
- * The generated swig_type_info structures are assigned staticly to an initial 
+ * The generated swig_type_info structures are assigned staticly to an initial
  * array. We just loop through that array, and handle each type individually.
  * First we lookup if this type has been already loaded, and if so, use the
  * loaded structure instead of the generated one. Then we have to fill in the
@@ -23219,17 +23213,17 @@ static swig_command_info swig_commands[] = {
  * a column is one of the swig_cast_info structures for that type.
  * The cast_initial array is actually an array of arrays, because each row has
  * a variable number of columns. So to actually build the cast linked list,
- * we find the array of casts associated with the type, and loop through it 
+ * we find the array of casts associated with the type, and loop through it
  * adding the casts to the list. The one last trick we need to do is making
  * sure the type pointer in the swig_cast_info struct is correct.
  *
- * First off, we lookup the cast->type name to see if it is already loaded. 
+ * First off, we lookup the cast->type name to see if it is already loaded.
  * There are three cases to handle:
  *  1) If the cast->type has already been loaded AND the type we are adding
  *     casting info to has not been loaded (it is in this module), THEN we
  *     replace the cast->type pointer with the type pointer that has already
  *     been loaded.
- *  2) If BOTH types (the one we are adding casting info to, and the 
+ *  2) If BOTH types (the one we are adding casting info to, and the
  *     cast->type) are loaded, THEN the cast info has already been loaded by
  *     the previous module so we just ignore it.
  *  3) Finally, if cast->type has not already been loaded, then we add that
@@ -23255,8 +23249,6 @@ SWIG_InitializeModule(void *clientdata) {
   swig_module_info *module_head, *iter;
   int found, init;
   
-  clientdata = clientdata;
-  
   /* check to see if the circular list has been setup, if not, set it up */
   if (swig_module.next==0) {
     /* Initialize the swig_module */
@@ -23294,7 +23286,7 @@ SWIG_InitializeModule(void *clientdata) {
     module_head->next = &swig_module;
   }
   
-  /* When multiple interpeters are used, a module could have already been initialized in
+  /* When multiple interpreters are used, a module could have already been initialized in
        a different interpreter, but not yet have a pointer in this interpreter.
        In this case, we do not want to continue adding types... everything should be
        set up already */
@@ -23447,7 +23439,7 @@ XS(SWIG_init) {
   
   /* Install commands */
   for (i = 0; swig_commands[i].name; i++) {
-    // Casts only needed for Perl < 5.10.
+    /* Casts only needed for Perl < 5.10. */
 #ifdef __cplusplus
     newXS(const_cast<char*>(swig_commands[i].name), swig_commands[i].wrapper, const_cast<char*>(__FILE__));
 #else
@@ -23508,7 +23500,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/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "TermProgress", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_NewFunctionPtrObj((void *)(int (*)(double,char const *,void *))(GDALTermProgress), SWIGTYPE_p_f_double_p_q_const__char_p_void__int));
     SvREADONLY_on(sv);
diff --git a/swig/perl/gdalconst_wrap.c b/swig/perl/gdalconst_wrap.c
index 866ea0f..9d7e4e8 100644
--- a/swig/perl/gdalconst_wrap.c
+++ b/swig/perl/gdalconst_wrap.c
@@ -1,11 +1,11 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
- * 
- * This file is not intended to be easily readable and contains a number of 
+ * Version 2.0.12
+ *
+ * This file is not intended to be easily readable and contains a number of
  * coding conventions designed to improve portability and efficiency. Do not make
- * changes to this file unless you know what you are doing--modify the SWIG 
- * interface file instead. 
+ * changes to this file unless you know what you are doing--modify the SWIG
+ * interface file instead.
  * ----------------------------------------------------------------------------- */
 
 #define SWIGPERL
@@ -42,28 +42,28 @@
 #ifndef SWIGUNUSED
 # if defined(__GNUC__)
 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#     define SWIGUNUSED __attribute__ ((__unused__))
 #   else
 #     define SWIGUNUSED
 #   endif
 # elif defined(__ICC)
-#   define SWIGUNUSED __attribute__ ((__unused__)) 
+#   define SWIGUNUSED __attribute__ ((__unused__))
 # else
-#   define SWIGUNUSED 
+#   define SWIGUNUSED
 # endif
 #endif
 
 #ifndef SWIG_MSC_UNSUPPRESS_4505
 # if defined(_MSC_VER)
 #   pragma warning(disable : 4505) /* unreferenced local function has been removed */
-# endif 
+# endif
 #endif
 
 #ifndef SWIGUNUSEDPARM
 # ifdef __cplusplus
 #   define SWIGUNUSEDPARM(p)
 # else
-#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
 # endif
 #endif
 
@@ -106,7 +106,7 @@
 #   define SWIGSTDCALL __stdcall
 # else
 #   define SWIGSTDCALL
-# endif 
+# endif
 #endif
 
 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
@@ -144,7 +144,7 @@
   You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
   creating a static or dynamic library from the SWIG runtime code.
   In 99.9% of the cases, SWIG just needs to declare them as 'static'.
-  
+
   But only do this if strictly necessary, ie, if you have problems
   with your compiler or suchlike.
 */
@@ -170,16 +170,16 @@
 #define SWIG_POINTER_OWN           0x1
 
 
-/* 
+/*
    Flags/methods for returning states.
-   
-   The SWIG conversion methods, as ConvertPtr, return an integer 
+
+   The SWIG conversion methods, as ConvertPtr, return an integer
    that tells if the conversion was successful or not. And if not,
    an error code can be returned (see swigerrors.swg for the codes).
-   
+
    Use the following macros/flags to set or process the returning
    states.
-   
+
    In old versions of SWIG, code such as the following was usually written:
 
      if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
@@ -212,23 +212,23 @@
     } else {
       // fail code
     }
-    
+
    I.e., now SWIG_ConvertPtr can return new objects and you can
    identify the case and take care of the deallocation. Of course that
    also requires SWIG_ConvertPtr to return new result values, such as
 
-      int SWIG_ConvertPtr(obj, ptr,...) {         
-        if (<obj is ok>) {			       
-          if (<need new object>) {		       
-            *ptr = <ptr to new allocated object>; 
-            return SWIG_NEWOBJ;		       
-          } else {				       
-            *ptr = <ptr to old object>;	       
-            return SWIG_OLDOBJ;		       
-          } 				       
-        } else {				       
-          return SWIG_BADOBJ;		       
-        }					       
+      int SWIG_ConvertPtr(obj, ptr,...) {
+        if (<obj is ok>) {
+          if (<need new object>) {
+            *ptr = <ptr to new allocated object>;
+            return SWIG_NEWOBJ;
+          } else {
+            *ptr = <ptr to old object>;
+            return SWIG_OLDOBJ;
+          }
+        } else {
+          return SWIG_BADOBJ;
+        }
       }
 
    Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
@@ -242,17 +242,17 @@
        int fooi(int);
 
    and you call
- 
+
       food(1)   // cast rank '1'  (1 -> 1.0)
       fooi(1)   // cast rank '0'
 
    just use the SWIG_AddCast()/SWIG_CheckState()
 */
 
-#define SWIG_OK                    (0) 
+#define SWIG_OK                    (0)
 #define SWIG_ERROR                 (-1)
 #define SWIG_IsOK(r)               (r >= 0)
-#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  
+#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)
 
 /* The CastRankLimit says how many bits are used for the cast rank */
 #define SWIG_CASTRANKLIMIT         (1 << 8)
@@ -283,14 +283,14 @@
 #  endif
 #  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
 #  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
-SWIGINTERNINLINE int SWIG_AddCast(int r) { 
+SWIGINTERNINLINE int SWIG_AddCast(int r) {
   return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
 }
-SWIGINTERNINLINE int SWIG_CheckState(int r) { 
-  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
+SWIGINTERNINLINE int SWIG_CheckState(int r) {
+  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
 }
 #else /* no cast-rank mode */
-#  define SWIG_AddCast
+#  define SWIG_AddCast(r) (r)
 #  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
 #endif
 
@@ -334,7 +334,7 @@ typedef struct swig_module_info {
   void                    *clientdata;		/* Language specific module data */
 } swig_module_info;
 
-/* 
+/*
   Compare two type names skipping the space characters, therefore
   "char*" == "char *" and "Class<int>" == "Class<int >", etc.
 
@@ -354,18 +354,18 @@ SWIG_TypeNameComp(const char *f1, const char *l1,
 
 /*
   Check type equivalence in a name list like <name1>|<name2>|...
-  Return 0 if not equal, 1 if equal
+  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
 */
 SWIGRUNTIME int
-SWIG_TypeEquiv(const char *nb, const char *tb) {
-  int equiv = 0;
+SWIG_TypeCmp(const char *nb, const char *tb) {
+  int equiv = 1;
   const char* te = tb + strlen(tb);
   const char* ne = nb;
-  while (!equiv && *ne) {
+  while (equiv != 0 && *ne) {
     for (nb = ne; *ne; ++ne) {
       if (*ne == '|') break;
     }
-    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    equiv = SWIG_TypeNameComp(nb, ne, tb, te);
     if (*ne) ++ne;
   }
   return equiv;
@@ -373,24 +373,13 @@ SWIG_TypeEquiv(const char *nb, const char *tb) {
 
 /*
   Check type equivalence in a name list like <name1>|<name2>|...
-  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
+  Return 0 if not equal, 1 if equal
 */
 SWIGRUNTIME int
-SWIG_TypeCompare(const char *nb, const char *tb) {
-  int equiv = 0;
-  const char* te = tb + strlen(tb);
-  const char* ne = nb;
-  while (!equiv && *ne) {
-    for (nb = ne; *ne; ++ne) {
-      if (*ne == '|') break;
-    }
-    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
-    if (*ne) ++ne;
-  }
-  return equiv;
+SWIG_TypeEquiv(const char *nb, const char *tb) {
+  return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
 }
 
-
 /*
   Check the typename
 */
@@ -418,7 +407,7 @@ SWIG_TypeCheck(const char *c, swig_type_info *ty) {
   return 0;
 }
 
-/* 
+/*
   Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
 */
 SWIGRUNTIME swig_cast_info *
@@ -453,7 +442,7 @@ SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
   return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
 }
 
-/* 
+/*
    Dynamic pointer casting. Down an inheritance hierarchy
 */
 SWIGRUNTIME swig_type_info *
@@ -497,7 +486,7 @@ SWIG_TypePrettyName(const swig_type_info *type) {
     return type->name;
 }
 
-/* 
+/*
    Set the clientdata field for a type
 */
 SWIGRUNTIME void
@@ -505,14 +494,14 @@ SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
   swig_cast_info *cast = ti->cast;
   /* if (ti->clientdata == clientdata) return; */
   ti->clientdata = clientdata;
-  
+
   while (cast) {
     if (!cast->converter) {
       swig_type_info *tc = cast->type;
       if (!tc->clientdata) {
 	SWIG_TypeClientData(tc, clientdata);
       }
-    }    
+    }
     cast = cast->next;
   }
 }
@@ -521,18 +510,18 @@ SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
   SWIG_TypeClientData(ti, clientdata);
   ti->owndata = 1;
 }
-  
+
 /*
   Search for a swig_type_info structure only by mangled name
   Search is a O(log #types)
-  
-  We start searching at module start, and finish searching when start == end.  
+
+  We start searching at module start, and finish searching when start == end.
   Note: if start == end at the beginning of the function, we go all the way around
   the circular list.
 */
 SWIGRUNTIME swig_type_info *
-SWIG_MangledTypeQueryModule(swig_module_info *start, 
-                            swig_module_info *end, 
+SWIG_MangledTypeQueryModule(swig_module_info *start,
+                            swig_module_info *end,
 		            const char *name) {
   swig_module_info *iter = start;
   do {
@@ -541,11 +530,11 @@ SWIG_MangledTypeQueryModule(swig_module_info *start,
       register size_t r = iter->size - 1;
       do {
 	/* since l+r >= 0, we can (>> 1) instead (/ 2) */
-	register size_t i = (l + r) >> 1; 
+	register size_t i = (l + r) >> 1;
 	const char *iname = iter->types[i]->name;
 	if (iname) {
 	  register int compare = strcmp(name, iname);
-	  if (compare == 0) {	    
+	  if (compare == 0) {
 	    return iter->types[i];
 	  } else if (compare < 0) {
 	    if (i) {
@@ -570,14 +559,14 @@ SWIG_MangledTypeQueryModule(swig_module_info *start,
   Search for a swig_type_info structure for either a mangled name or a human readable name.
   It first searches the mangled names of the types, which is a O(log #types)
   If a type is not found it then searches the human readable names, which is O(#types).
-  
-  We start searching at module start, and finish searching when start == end.  
+
+  We start searching at module start, and finish searching when start == end.
   Note: if start == end at the beginning of the function, we go all the way around
   the circular list.
 */
 SWIGRUNTIME swig_type_info *
-SWIG_TypeQueryModule(swig_module_info *start, 
-                     swig_module_info *end, 
+SWIG_TypeQueryModule(swig_module_info *start,
+                     swig_module_info *end,
 		     const char *name) {
   /* STEP 1: Search the name field using binary search */
   swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
@@ -596,12 +585,12 @@ SWIG_TypeQueryModule(swig_module_info *start,
       iter = iter->next;
     } while (iter != end);
   }
-  
+
   /* neither found a match */
   return 0;
 }
 
-/* 
+/*
    Pack binary data into a string
 */
 SWIGRUNTIME char *
@@ -617,7 +606,7 @@ SWIG_PackData(char *c, void *ptr, size_t sz) {
   return c;
 }
 
-/* 
+/*
    Unpack binary data from a string
 */
 SWIGRUNTIME const char *
@@ -631,21 +620,21 @@ SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
       uu = ((d - '0') << 4);
     else if ((d >= 'a') && (d <= 'f'))
       uu = ((d - ('a'-10)) << 4);
-    else 
+    else
       return (char *) 0;
     d = *(c++);
     if ((d >= '0') && (d <= '9'))
       uu |= (d - '0');
     else if ((d >= 'a') && (d <= 'f'))
       uu |= (d - ('a'-10));
-    else 
+    else
       return (char *) 0;
     *u = uu;
   }
   return c;
 }
 
-/* 
+/*
    Pack 'void *' into a string buffer.
 */
 SWIGRUNTIME char *
@@ -705,18 +694,18 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
 #endif
 
 /*  Errors in SWIG */
-#define  SWIG_UnknownError    	   -1 
-#define  SWIG_IOError        	   -2 
-#define  SWIG_RuntimeError   	   -3 
-#define  SWIG_IndexError     	   -4 
-#define  SWIG_TypeError      	   -5 
-#define  SWIG_DivisionByZero 	   -6 
-#define  SWIG_OverflowError  	   -7 
-#define  SWIG_SyntaxError    	   -8 
-#define  SWIG_ValueError     	   -9 
+#define  SWIG_UnknownError    	   -1
+#define  SWIG_IOError        	   -2
+#define  SWIG_RuntimeError   	   -3
+#define  SWIG_IndexError     	   -4
+#define  SWIG_TypeError      	   -5
+#define  SWIG_DivisionByZero 	   -6
+#define  SWIG_OverflowError  	   -7
+#define  SWIG_SyntaxError    	   -8
+#define  SWIG_ValueError     	   -9
 #define  SWIG_SystemError    	   -10
 #define  SWIG_AttributeError 	   -11
-#define  SWIG_MemoryError    	   -12 
+#define  SWIG_MemoryError    	   -12
 #define  SWIG_NullReferenceError   -13
 
 
@@ -901,7 +890,7 @@ SWIG_Perl_ErrorType(int code) {
 
 /* Runtime API */
 
-#define SWIG_GetModule(clientdata)                      SWIG_Perl_GetModule()
+#define SWIG_GetModule(clientdata)                      SWIG_Perl_GetModule(clientdata)
 #define SWIG_SetModule(clientdata, pointer)             SWIG_Perl_SetModule(pointer)
 
 
@@ -1338,7 +1327,7 @@ SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, i
 
 
 SWIGRUNTIME swig_module_info *
-SWIG_Perl_GetModule(void) {
+SWIG_Perl_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
   static void *type_pointer = (void *)0;
   SV *pointer;
 
@@ -1432,9 +1421,6 @@ SWIG_Perl_SetModule(swig_module_info *module) {
 #ifdef eof
   #undef eof
 #endif
-#ifdef bool
-  #undef bool
-#endif
 #ifdef close
   #undef close
 #endif
@@ -1475,6 +1461,14 @@ SWIG_Perl_SetModule(swig_module_info *module) {
   #undef stat
 #endif
 
+#ifdef bool
+  /* Leave if macro is from C99 stdbool.h */
+  #ifndef __bool_true_false_are_defined
+    #undef bool
+  #endif
+#endif
+
+
 
 
 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
@@ -1498,7 +1492,7 @@ static swig_module_info swig_module = {swig_types, 1, 0, 0, 0, 0};
 #define SWIG_name   "Geo::GDAL::Constc::boot_Geo__GDAL__Const"
 #define SWIG_prefix "Geo::GDAL::Constc::"
 
-#define SWIGVERSION 0x020007 
+#define SWIGVERSION 0x020012 
 #define SWIG_VERSION SWIGVERSION
 
 
@@ -1625,18 +1619,18 @@ static swig_command_info swig_commands[] = {
 };
 /* -----------------------------------------------------------------------------
  * Type initialization:
- * This problem is tough by the requirement that no dynamic 
- * memory is used. Also, since swig_type_info structures store pointers to 
+ * This problem is tough by the requirement that no dynamic
+ * memory is used. Also, since swig_type_info structures store pointers to
  * swig_cast_info structures and swig_cast_info structures store pointers back
- * to swig_type_info structures, we need some lookup code at initialization. 
- * The idea is that swig generates all the structures that are needed. 
- * The runtime then collects these partially filled structures. 
- * The SWIG_InitializeModule function takes these initial arrays out of 
+ * to swig_type_info structures, we need some lookup code at initialization.
+ * The idea is that swig generates all the structures that are needed.
+ * The runtime then collects these partially filled structures.
+ * The SWIG_InitializeModule function takes these initial arrays out of
  * swig_module, and does all the lookup, filling in the swig_module.types
  * array with the correct data and linking the correct swig_cast_info
  * structures together.
  *
- * The generated swig_type_info structures are assigned staticly to an initial 
+ * The generated swig_type_info structures are assigned staticly to an initial
  * array. We just loop through that array, and handle each type individually.
  * First we lookup if this type has been already loaded, and if so, use the
  * loaded structure instead of the generated one. Then we have to fill in the
@@ -1646,17 +1640,17 @@ static swig_command_info swig_commands[] = {
  * a column is one of the swig_cast_info structures for that type.
  * The cast_initial array is actually an array of arrays, because each row has
  * a variable number of columns. So to actually build the cast linked list,
- * we find the array of casts associated with the type, and loop through it 
+ * we find the array of casts associated with the type, and loop through it
  * adding the casts to the list. The one last trick we need to do is making
  * sure the type pointer in the swig_cast_info struct is correct.
  *
- * First off, we lookup the cast->type name to see if it is already loaded. 
+ * First off, we lookup the cast->type name to see if it is already loaded.
  * There are three cases to handle:
  *  1) If the cast->type has already been loaded AND the type we are adding
  *     casting info to has not been loaded (it is in this module), THEN we
  *     replace the cast->type pointer with the type pointer that has already
  *     been loaded.
- *  2) If BOTH types (the one we are adding casting info to, and the 
+ *  2) If BOTH types (the one we are adding casting info to, and the
  *     cast->type) are loaded, THEN the cast info has already been loaded by
  *     the previous module so we just ignore it.
  *  3) Finally, if cast->type has not already been loaded, then we add that
@@ -1682,8 +1676,6 @@ SWIG_InitializeModule(void *clientdata) {
   swig_module_info *module_head, *iter;
   int found, init;
   
-  clientdata = clientdata;
-  
   /* check to see if the circular list has been setup, if not, set it up */
   if (swig_module.next==0) {
     /* Initialize the swig_module */
@@ -1721,7 +1713,7 @@ SWIG_InitializeModule(void *clientdata) {
     module_head->next = &swig_module;
   }
   
-  /* When multiple interpeters are used, a module could have already been initialized in
+  /* When multiple interpreters are used, a module could have already been initialized in
        a different interpreter, but not yet have a pointer in this interpreter.
        In this case, we do not want to continue adding types... everything should be
        set up already */
@@ -1874,7 +1866,7 @@ XS(SWIG_init) {
   
   /* Install commands */
   for (i = 0; swig_commands[i].name; i++) {
-    // Casts only needed for Perl < 5.10.
+    /* Casts only needed for Perl < 5.10. */
 #ifdef __cplusplus
     newXS(const_cast<char*>(swig_commands[i].name), swig_commands[i].wrapper, const_cast<char*>(__FILE__));
 #else
@@ -1920,687 +1912,687 @@ XS(SWIG_init) {
     SvREADONLY_on(sv);
   }
   
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GDT_Unknown", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDT_Unknown)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GDT_Byte", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDT_Byte)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GDT_UInt16", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDT_UInt16)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GDT_Int16", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDT_Int16)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GDT_UInt32", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDT_UInt32)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GDT_Int32", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDT_Int32)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GDT_Float32", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDT_Float32)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GDT_Float64", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDT_Float64)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GDT_CInt16", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDT_CInt16)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GDT_CInt32", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDT_CInt32)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GDT_CFloat32", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDT_CFloat32)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GDT_CFloat64", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDT_CFloat64)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GDT_TypeCount", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDT_TypeCount)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GA_ReadOnly", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GA_ReadOnly)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GA_Update", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GA_Update)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GF_Read", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GF_Read)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GF_Write", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GF_Write)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GRIORA_NearestNeighbour", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GRIORA_NearestNeighbour)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GRIORA_Bilinear", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GRIORA_Bilinear)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GRIORA_Cubic", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GRIORA_Cubic)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GRIORA_CubicSpline", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GRIORA_CubicSpline)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GRIORA_Lanczos", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GRIORA_Lanczos)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GRIORA_Average", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GRIORA_Average)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GRIORA_Mode", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GRIORA_Mode)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GRIORA_Gauss", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GRIORA_Gauss)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GCI_Undefined", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_Undefined)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GCI_GrayIndex", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_GrayIndex)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GCI_PaletteIndex", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_PaletteIndex)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GCI_RedBand", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_RedBand)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GCI_GreenBand", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_GreenBand)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GCI_BlueBand", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_BlueBand)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GCI_AlphaBand", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_AlphaBand)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GCI_HueBand", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_HueBand)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GCI_SaturationBand", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_SaturationBand)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GCI_LightnessBand", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_LightnessBand)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GCI_CyanBand", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_CyanBand)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GCI_MagentaBand", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_MagentaBand)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GCI_YellowBand", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_YellowBand)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GCI_BlackBand", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_BlackBand)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GCI_YCbCr_YBand", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_YCbCr_YBand)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GCI_YCbCr_CrBand", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_YCbCr_CrBand)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GCI_YCbCr_CbBand", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_YCbCr_CbBand)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GRA_NearestNeighbour", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GRA_NearestNeighbour)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GRA_Bilinear", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GRA_Bilinear)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GRA_Cubic", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GRA_Cubic)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GRA_CubicSpline", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GRA_CubicSpline)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GRA_Lanczos", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GRA_Lanczos)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GRA_Average", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GRA_Average)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GRA_Mode", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GRA_Mode)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GPI_Gray", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GPI_Gray)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GPI_RGB", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GPI_RGB)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GPI_CMYK", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GPI_CMYK)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GPI_HLS", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GPI_HLS)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "CXT_Element", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CXT_Element)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "CXT_Text", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CXT_Text)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "CXT_Attribute", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CXT_Attribute)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "CXT_Comment", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CXT_Comment)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "CXT_Literal", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CXT_Literal)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "CE_None", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CE_None)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "CE_Debug", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CE_Debug)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "CE_Warning", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CE_Warning)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "CE_Failure", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CE_Failure)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "CE_Fatal", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CE_Fatal)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "CPLE_None", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CPLE_None)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "CPLE_AppDefined", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CPLE_AppDefined)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "CPLE_OutOfMemory", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CPLE_OutOfMemory)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "CPLE_FileIO", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CPLE_FileIO)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "CPLE_OpenFailed", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CPLE_OpenFailed)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "CPLE_IllegalArg", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CPLE_IllegalArg)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "CPLE_NotSupported", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CPLE_NotSupported)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "CPLE_AssertionFailed", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CPLE_AssertionFailed)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "CPLE_NoWriteAccess", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CPLE_NoWriteAccess)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "CPLE_UserInterrupt", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CPLE_UserInterrupt)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OF_ALL", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDAL_OF_ALL)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OF_RASTER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDAL_OF_RASTER)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OF_VECTOR", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDAL_OF_VECTOR)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OF_READONLY", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDAL_OF_READONLY)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OF_UPDATE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDAL_OF_UPDATE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OF_SHARED", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDAL_OF_SHARED)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OF_VERBOSE_ERROR", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDAL_OF_VERBOSE_ERROR)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "DMD_LONGNAME", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr(GDAL_DMD_LONGNAME));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "DMD_HELPTOPIC", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr(GDAL_DMD_HELPTOPIC));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "DMD_MIMETYPE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr(GDAL_DMD_MIMETYPE));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "DMD_EXTENSION", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr(GDAL_DMD_EXTENSION));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "DMD_EXTENSIONS", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr(GDAL_DMD_EXTENSIONS));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "DMD_CONNECTION_PREFIX", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr(GDAL_DMD_CONNECTION_PREFIX));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "DMD_CREATIONOPTIONLIST", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr(GDAL_DMD_CREATIONOPTIONLIST));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "DMD_CREATIONDATATYPES", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr(GDAL_DMD_CREATIONDATATYPES));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "DMD_CREATIONFIELDDATATYPES", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr(GDAL_DMD_CREATIONFIELDDATATYPES));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "DMD_SUBDATASETS", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr(GDAL_DMD_SUBDATASETS));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "DCAP_OPEN", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr(GDAL_DCAP_OPEN));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "DCAP_CREATE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr(GDAL_DCAP_CREATE));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "DCAP_CREATECOPY", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr(GDAL_DCAP_CREATECOPY));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "DCAP_VIRTUALIO", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr(GDAL_DCAP_VIRTUALIO));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "DCAP_RASTER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr(GDAL_DCAP_RASTER));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "DCAP_VECTOR", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr(GDAL_DCAP_VECTOR));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "DCAP_NOTNULL_FIELDS", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr(GDAL_DCAP_NOTNULL_FIELDS));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "DCAP_DEFAULT_FIELDS", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr(GDAL_DCAP_DEFAULT_FIELDS));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "DCAP_NOTNULL_GEOMFIELDS", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr(GDAL_DCAP_NOTNULL_GEOMFIELDS));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "CPLES_BackslashQuotable", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CPLES_BackslashQuotable)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "CPLES_XML", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CPLES_XML)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "CPLES_URL", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CPLES_URL)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "CPLES_SQL", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CPLES_SQL)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "CPLES_CSV", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CPLES_CSV)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GFT_Integer", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFT_Integer)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GFT_Real", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFT_Real)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GFT_String", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFT_String)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GFU_Generic", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_Generic)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GFU_PixelCount", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_PixelCount)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GFU_Name", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_Name)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GFU_Min", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_Min)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GFU_Max", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_Max)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GFU_MinMax", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_MinMax)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GFU_Red", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_Red)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GFU_Green", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_Green)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GFU_Blue", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_Blue)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GFU_Alpha", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_Alpha)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GFU_RedMin", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_RedMin)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GFU_GreenMin", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_GreenMin)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GFU_BlueMin", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_BlueMin)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GFU_AlphaMin", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_AlphaMin)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GFU_RedMax", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_RedMax)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GFU_GreenMax", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_GreenMax)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GFU_BlueMax", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_BlueMax)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GFU_AlphaMax", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_AlphaMax)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GFU_MaxCount", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_MaxCount)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GMF_ALL_VALID", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(0x01)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GMF_PER_DATASET", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(0x02)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GMF_ALPHA", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(0x04)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GMF_NODATA", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(0x08)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GARIO_PENDING", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GARIO_PENDING)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GARIO_UPDATE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GARIO_UPDATE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GARIO_ERROR", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GARIO_ERROR)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GARIO_COMPLETE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GARIO_COMPLETE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GTO_TIP", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GTO_TIP)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GTO_BIT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GTO_BIT)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "GTO_BSQ", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GTO_BSQ)));
     SvREADONLY_on(sv);
diff --git a/swig/perl/lib/Geo/GDAL.pm b/swig/perl/lib/Geo/GDAL.pm
index 89e0f5a..0d2753c 100644
--- a/swig/perl/lib/Geo/GDAL.pm
+++ b/swig/perl/lib/Geo/GDAL.pm
@@ -1,5 +1,5 @@
 # This file was automatically generated by SWIG (http://www.swig.org).
-# Version 2.0.7
+# Version 2.0.12
 #
 # Do not make changes to this file unless you know what you are doing--modify
 # the SWIG interface file instead.
@@ -611,8 +611,8 @@ use Geo::OSR;
 # For GDAL 2.0 or above, GDAL X.Y.Z should then
 # VERSION = X + Y / 100.0 + Z / 10000.0
 
-our $VERSION = '2.0001';
-our $GDAL_VERSION = '2.0.1';
+our $VERSION = '2.0002';
+our $GDAL_VERSION = '2.0.2';
 
 =pod
 
diff --git a/swig/perl/lib/Geo/GDAL/Const.pm b/swig/perl/lib/Geo/GDAL/Const.pm
index e050e7a..ac7c710 100644
--- a/swig/perl/lib/Geo/GDAL/Const.pm
+++ b/swig/perl/lib/Geo/GDAL/Const.pm
@@ -1,5 +1,5 @@
 # This file was automatically generated by SWIG (http://www.swig.org).
-# Version 2.0.7
+# Version 2.0.12
 #
 # Do not make changes to this file unless you know what you are doing--modify
 # the SWIG interface file instead.
diff --git a/swig/perl/lib/Geo/OGR.pm b/swig/perl/lib/Geo/OGR.pm
index 04c948d..8dc87b1 100644
--- a/swig/perl/lib/Geo/OGR.pm
+++ b/swig/perl/lib/Geo/OGR.pm
@@ -1,5 +1,5 @@
 # This file was automatically generated by SWIG (http://www.swig.org).
-# Version 2.0.7
+# Version 2.0.12
 #
 # Do not make changes to this file unless you know what you are doing--modify
 # the SWIG interface file instead.
@@ -312,9 +312,17 @@ sub DESTROY {
     $self->RELEASE_PARENTS();
 }
 
+use Carp;
 sub new {
     my $pkg = shift;
-    my $self = Geo::OGRc::new_Feature(@_);
+    my $arg = blessed($_[0]);
+    my $defn;
+    if ($arg && $arg eq 'Geo::OGR::FeatureDefn') {
+        $defn = $_[0];
+    } else {
+        $defn = Geo::OGR::FeatureDefn->new(@_);
+    }
+    my $self = Geo::OGRc::new_Feature($defn);
     bless $self, $pkg if defined($self);
 }
 
@@ -911,7 +919,7 @@ package Geo::OGR;
 
 
 package Geo::OGR;
-our $VERSION = '2.0001'; # this needs to be the same as that in gdal_perl.i
+our $VERSION = '2.0002'; # this needs to be the same as that in gdal_perl.i
 
 package Geo::OGR::Driver;
 use strict;
diff --git a/swig/perl/lib/Geo/OSR.pm b/swig/perl/lib/Geo/OSR.pm
index bc2a2e5..058215f 100644
--- a/swig/perl/lib/Geo/OSR.pm
+++ b/swig/perl/lib/Geo/OSR.pm
@@ -1,5 +1,5 @@
 # This file was automatically generated by SWIG (http://www.swig.org).
-# Version 2.0.7
+# Version 2.0.12
 #
 # Do not make changes to this file unless you know what you are doing--modify
 # the SWIG interface file instead.
diff --git a/swig/perl/ogr_wrap.cpp b/swig/perl/ogr_wrap.cpp
index 1e9144a..6439b65 100644
--- a/swig/perl/ogr_wrap.cpp
+++ b/swig/perl/ogr_wrap.cpp
@@ -1,11 +1,11 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
- * 
- * This file is not intended to be easily readable and contains a number of 
+ * Version 2.0.12
+ *
+ * This file is not intended to be easily readable and contains a number of
  * coding conventions designed to improve portability and efficiency. Do not make
- * changes to this file unless you know what you are doing--modify the SWIG 
- * interface file instead. 
+ * changes to this file unless you know what you are doing--modify the SWIG
+ * interface file instead.
  * ----------------------------------------------------------------------------- */
 
 #define SWIGPERL
@@ -66,28 +66,28 @@ template <typename T> T SwigValueInit() {
 #ifndef SWIGUNUSED
 # if defined(__GNUC__)
 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#     define SWIGUNUSED __attribute__ ((__unused__))
 #   else
 #     define SWIGUNUSED
 #   endif
 # elif defined(__ICC)
-#   define SWIGUNUSED __attribute__ ((__unused__)) 
+#   define SWIGUNUSED __attribute__ ((__unused__))
 # else
-#   define SWIGUNUSED 
+#   define SWIGUNUSED
 # endif
 #endif
 
 #ifndef SWIG_MSC_UNSUPPRESS_4505
 # if defined(_MSC_VER)
 #   pragma warning(disable : 4505) /* unreferenced local function has been removed */
-# endif 
+# endif
 #endif
 
 #ifndef SWIGUNUSEDPARM
 # ifdef __cplusplus
 #   define SWIGUNUSEDPARM(p)
 # else
-#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
 # endif
 #endif
 
@@ -130,7 +130,7 @@ template <typename T> T SwigValueInit() {
 #   define SWIGSTDCALL __stdcall
 # else
 #   define SWIGSTDCALL
-# endif 
+# endif
 #endif
 
 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
@@ -168,7 +168,7 @@ template <typename T> T SwigValueInit() {
   You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
   creating a static or dynamic library from the SWIG runtime code.
   In 99.9% of the cases, SWIG just needs to declare them as 'static'.
-  
+
   But only do this if strictly necessary, ie, if you have problems
   with your compiler or suchlike.
 */
@@ -194,16 +194,16 @@ template <typename T> T SwigValueInit() {
 #define SWIG_POINTER_OWN           0x1
 
 
-/* 
+/*
    Flags/methods for returning states.
-   
-   The SWIG conversion methods, as ConvertPtr, return an integer 
+
+   The SWIG conversion methods, as ConvertPtr, return an integer
    that tells if the conversion was successful or not. And if not,
    an error code can be returned (see swigerrors.swg for the codes).
-   
+
    Use the following macros/flags to set or process the returning
    states.
-   
+
    In old versions of SWIG, code such as the following was usually written:
 
      if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
@@ -236,23 +236,23 @@ template <typename T> T SwigValueInit() {
     } else {
       // fail code
     }
-    
+
    I.e., now SWIG_ConvertPtr can return new objects and you can
    identify the case and take care of the deallocation. Of course that
    also requires SWIG_ConvertPtr to return new result values, such as
 
-      int SWIG_ConvertPtr(obj, ptr,...) {         
-        if (<obj is ok>) {			       
-          if (<need new object>) {		       
-            *ptr = <ptr to new allocated object>; 
-            return SWIG_NEWOBJ;		       
-          } else {				       
-            *ptr = <ptr to old object>;	       
-            return SWIG_OLDOBJ;		       
-          } 				       
-        } else {				       
-          return SWIG_BADOBJ;		       
-        }					       
+      int SWIG_ConvertPtr(obj, ptr,...) {
+        if (<obj is ok>) {
+          if (<need new object>) {
+            *ptr = <ptr to new allocated object>;
+            return SWIG_NEWOBJ;
+          } else {
+            *ptr = <ptr to old object>;
+            return SWIG_OLDOBJ;
+          }
+        } else {
+          return SWIG_BADOBJ;
+        }
       }
 
    Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
@@ -266,17 +266,17 @@ template <typename T> T SwigValueInit() {
        int fooi(int);
 
    and you call
- 
+
       food(1)   // cast rank '1'  (1 -> 1.0)
       fooi(1)   // cast rank '0'
 
    just use the SWIG_AddCast()/SWIG_CheckState()
 */
 
-#define SWIG_OK                    (0) 
+#define SWIG_OK                    (0)
 #define SWIG_ERROR                 (-1)
 #define SWIG_IsOK(r)               (r >= 0)
-#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  
+#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)
 
 /* The CastRankLimit says how many bits are used for the cast rank */
 #define SWIG_CASTRANKLIMIT         (1 << 8)
@@ -307,14 +307,14 @@ template <typename T> T SwigValueInit() {
 #  endif
 #  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
 #  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
-SWIGINTERNINLINE int SWIG_AddCast(int r) { 
+SWIGINTERNINLINE int SWIG_AddCast(int r) {
   return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
 }
-SWIGINTERNINLINE int SWIG_CheckState(int r) { 
-  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
+SWIGINTERNINLINE int SWIG_CheckState(int r) {
+  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
 }
 #else /* no cast-rank mode */
-#  define SWIG_AddCast
+#  define SWIG_AddCast(r) (r)
 #  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
 #endif
 
@@ -358,7 +358,7 @@ typedef struct swig_module_info {
   void                    *clientdata;		/* Language specific module data */
 } swig_module_info;
 
-/* 
+/*
   Compare two type names skipping the space characters, therefore
   "char*" == "char *" and "Class<int>" == "Class<int >", etc.
 
@@ -378,18 +378,18 @@ SWIG_TypeNameComp(const char *f1, const char *l1,
 
 /*
   Check type equivalence in a name list like <name1>|<name2>|...
-  Return 0 if not equal, 1 if equal
+  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
 */
 SWIGRUNTIME int
-SWIG_TypeEquiv(const char *nb, const char *tb) {
-  int equiv = 0;
+SWIG_TypeCmp(const char *nb, const char *tb) {
+  int equiv = 1;
   const char* te = tb + strlen(tb);
   const char* ne = nb;
-  while (!equiv && *ne) {
+  while (equiv != 0 && *ne) {
     for (nb = ne; *ne; ++ne) {
       if (*ne == '|') break;
     }
-    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    equiv = SWIG_TypeNameComp(nb, ne, tb, te);
     if (*ne) ++ne;
   }
   return equiv;
@@ -397,24 +397,13 @@ SWIG_TypeEquiv(const char *nb, const char *tb) {
 
 /*
   Check type equivalence in a name list like <name1>|<name2>|...
-  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
+  Return 0 if not equal, 1 if equal
 */
 SWIGRUNTIME int
-SWIG_TypeCompare(const char *nb, const char *tb) {
-  int equiv = 0;
-  const char* te = tb + strlen(tb);
-  const char* ne = nb;
-  while (!equiv && *ne) {
-    for (nb = ne; *ne; ++ne) {
-      if (*ne == '|') break;
-    }
-    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
-    if (*ne) ++ne;
-  }
-  return equiv;
+SWIG_TypeEquiv(const char *nb, const char *tb) {
+  return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
 }
 
-
 /*
   Check the typename
 */
@@ -442,7 +431,7 @@ SWIG_TypeCheck(const char *c, swig_type_info *ty) {
   return 0;
 }
 
-/* 
+/*
   Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
 */
 SWIGRUNTIME swig_cast_info *
@@ -477,7 +466,7 @@ SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
   return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
 }
 
-/* 
+/*
    Dynamic pointer casting. Down an inheritance hierarchy
 */
 SWIGRUNTIME swig_type_info *
@@ -521,7 +510,7 @@ SWIG_TypePrettyName(const swig_type_info *type) {
     return type->name;
 }
 
-/* 
+/*
    Set the clientdata field for a type
 */
 SWIGRUNTIME void
@@ -529,14 +518,14 @@ SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
   swig_cast_info *cast = ti->cast;
   /* if (ti->clientdata == clientdata) return; */
   ti->clientdata = clientdata;
-  
+
   while (cast) {
     if (!cast->converter) {
       swig_type_info *tc = cast->type;
       if (!tc->clientdata) {
 	SWIG_TypeClientData(tc, clientdata);
       }
-    }    
+    }
     cast = cast->next;
   }
 }
@@ -545,18 +534,18 @@ SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
   SWIG_TypeClientData(ti, clientdata);
   ti->owndata = 1;
 }
-  
+
 /*
   Search for a swig_type_info structure only by mangled name
   Search is a O(log #types)
-  
-  We start searching at module start, and finish searching when start == end.  
+
+  We start searching at module start, and finish searching when start == end.
   Note: if start == end at the beginning of the function, we go all the way around
   the circular list.
 */
 SWIGRUNTIME swig_type_info *
-SWIG_MangledTypeQueryModule(swig_module_info *start, 
-                            swig_module_info *end, 
+SWIG_MangledTypeQueryModule(swig_module_info *start,
+                            swig_module_info *end,
 		            const char *name) {
   swig_module_info *iter = start;
   do {
@@ -565,11 +554,11 @@ SWIG_MangledTypeQueryModule(swig_module_info *start,
       register size_t r = iter->size - 1;
       do {
 	/* since l+r >= 0, we can (>> 1) instead (/ 2) */
-	register size_t i = (l + r) >> 1; 
+	register size_t i = (l + r) >> 1;
 	const char *iname = iter->types[i]->name;
 	if (iname) {
 	  register int compare = strcmp(name, iname);
-	  if (compare == 0) {	    
+	  if (compare == 0) {
 	    return iter->types[i];
 	  } else if (compare < 0) {
 	    if (i) {
@@ -594,14 +583,14 @@ SWIG_MangledTypeQueryModule(swig_module_info *start,
   Search for a swig_type_info structure for either a mangled name or a human readable name.
   It first searches the mangled names of the types, which is a O(log #types)
   If a type is not found it then searches the human readable names, which is O(#types).
-  
-  We start searching at module start, and finish searching when start == end.  
+
+  We start searching at module start, and finish searching when start == end.
   Note: if start == end at the beginning of the function, we go all the way around
   the circular list.
 */
 SWIGRUNTIME swig_type_info *
-SWIG_TypeQueryModule(swig_module_info *start, 
-                     swig_module_info *end, 
+SWIG_TypeQueryModule(swig_module_info *start,
+                     swig_module_info *end,
 		     const char *name) {
   /* STEP 1: Search the name field using binary search */
   swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
@@ -620,12 +609,12 @@ SWIG_TypeQueryModule(swig_module_info *start,
       iter = iter->next;
     } while (iter != end);
   }
-  
+
   /* neither found a match */
   return 0;
 }
 
-/* 
+/*
    Pack binary data into a string
 */
 SWIGRUNTIME char *
@@ -641,7 +630,7 @@ SWIG_PackData(char *c, void *ptr, size_t sz) {
   return c;
 }
 
-/* 
+/*
    Unpack binary data from a string
 */
 SWIGRUNTIME const char *
@@ -655,21 +644,21 @@ SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
       uu = ((d - '0') << 4);
     else if ((d >= 'a') && (d <= 'f'))
       uu = ((d - ('a'-10)) << 4);
-    else 
+    else
       return (char *) 0;
     d = *(c++);
     if ((d >= '0') && (d <= '9'))
       uu |= (d - '0');
     else if ((d >= 'a') && (d <= 'f'))
       uu |= (d - ('a'-10));
-    else 
+    else
       return (char *) 0;
     *u = uu;
   }
   return c;
 }
 
-/* 
+/*
    Pack 'void *' into a string buffer.
 */
 SWIGRUNTIME char *
@@ -729,18 +718,18 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
 #endif
 
 /*  Errors in SWIG */
-#define  SWIG_UnknownError    	   -1 
-#define  SWIG_IOError        	   -2 
-#define  SWIG_RuntimeError   	   -3 
-#define  SWIG_IndexError     	   -4 
-#define  SWIG_TypeError      	   -5 
-#define  SWIG_DivisionByZero 	   -6 
-#define  SWIG_OverflowError  	   -7 
-#define  SWIG_SyntaxError    	   -8 
-#define  SWIG_ValueError     	   -9 
+#define  SWIG_UnknownError    	   -1
+#define  SWIG_IOError        	   -2
+#define  SWIG_RuntimeError   	   -3
+#define  SWIG_IndexError     	   -4
+#define  SWIG_TypeError      	   -5
+#define  SWIG_DivisionByZero 	   -6
+#define  SWIG_OverflowError  	   -7
+#define  SWIG_SyntaxError    	   -8
+#define  SWIG_ValueError     	   -9
 #define  SWIG_SystemError    	   -10
 #define  SWIG_AttributeError 	   -11
-#define  SWIG_MemoryError    	   -12 
+#define  SWIG_MemoryError    	   -12
 #define  SWIG_NullReferenceError   -13
 
 
@@ -925,7 +914,7 @@ SWIG_Perl_ErrorType(int code) {
 
 /* Runtime API */
 
-#define SWIG_GetModule(clientdata)                      SWIG_Perl_GetModule()
+#define SWIG_GetModule(clientdata)                      SWIG_Perl_GetModule(clientdata)
 #define SWIG_SetModule(clientdata, pointer)             SWIG_Perl_SetModule(pointer)
 
 
@@ -1362,7 +1351,7 @@ SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, i
 
 
 SWIGRUNTIME swig_module_info *
-SWIG_Perl_GetModule(void) {
+SWIG_Perl_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
   static void *type_pointer = (void *)0;
   SV *pointer;
 
@@ -1456,9 +1445,6 @@ SWIG_Perl_SetModule(swig_module_info *module) {
 #ifdef eof
   #undef eof
 #endif
-#ifdef bool
-  #undef bool
-#endif
 #ifdef close
   #undef close
 #endif
@@ -1499,6 +1485,14 @@ SWIG_Perl_SetModule(swig_module_info *module) {
   #undef stat
 #endif
 
+#ifdef bool
+  /* Leave if macro is from C99 stdbool.h */
+  #ifndef __bool_true_false_are_defined
+    #undef bool
+  #endif
+#endif
+
+
 
 
 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
@@ -1547,7 +1541,7 @@ static swig_module_info swig_module = {swig_types, 23, 0, 0, 0, 0};
 #define SWIG_name   "Geo::OGRc::boot_Geo__OGR"
 #define SWIG_prefix "Geo::OGRc::"
 
-#define SWIGVERSION 0x020007 
+#define SWIGVERSION 0x020012 
 #define SWIG_VERSION SWIGVERSION
 
 
@@ -2449,13 +2443,34 @@ SWIGINTERN void OGRFeatureShadow_SetField__SWIG_2(OGRFeatureShadow *self,int id,
     OGR_F_SetFieldDouble(self, id, value);
   }
 
+/* Getting isfinite working pre C99 across multiple platforms is non-trivial. Users can provide SWIG_isfinite on older platforms. */
+#ifndef SWIG_isfinite
+# if defined(isfinite)
+#  define SWIG_isfinite(X) (isfinite(X))
+# elif defined(_MSC_VER)
+#  define SWIG_isfinite(X) (_finite(X))
+# elif defined(__sun) && defined(__SVR4)
+#  include <ieeefp.h>
+#  define SWIG_isfinite(X) (finite(X))
+# endif
+#endif
+
+
+/* Accept infinite as a valid float value unless we are unable to check if a value is finite */
+#ifdef SWIG_isfinite
+# define SWIG_Float_Overflow_Check(X) ((X < -FLT_MAX || X > FLT_MAX) && SWIG_isfinite(X))
+#else
+# define SWIG_Float_Overflow_Check(X) ((X < -FLT_MAX || X > FLT_MAX))
+#endif
+
+
 SWIGINTERN int
 SWIG_AsVal_float SWIG_PERL_DECL_ARGS_2(SV * obj, float *val)
 {
   double v;
   int res = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj, &v);
   if (SWIG_IsOK(res)) {
-    if ((v < -FLT_MAX || v > FLT_MAX)) {
+    if (SWIG_Float_Overflow_Check(v)) {
       return SWIG_OverflowError;
     } else {
       if (val) *val = static_cast< float >(v);
@@ -25814,18 +25829,18 @@ static swig_command_info swig_commands[] = {
 };
 /* -----------------------------------------------------------------------------
  * Type initialization:
- * This problem is tough by the requirement that no dynamic 
- * memory is used. Also, since swig_type_info structures store pointers to 
+ * This problem is tough by the requirement that no dynamic
+ * memory is used. Also, since swig_type_info structures store pointers to
  * swig_cast_info structures and swig_cast_info structures store pointers back
- * to swig_type_info structures, we need some lookup code at initialization. 
- * The idea is that swig generates all the structures that are needed. 
- * The runtime then collects these partially filled structures. 
- * The SWIG_InitializeModule function takes these initial arrays out of 
+ * to swig_type_info structures, we need some lookup code at initialization.
+ * The idea is that swig generates all the structures that are needed.
+ * The runtime then collects these partially filled structures.
+ * The SWIG_InitializeModule function takes these initial arrays out of
  * swig_module, and does all the lookup, filling in the swig_module.types
  * array with the correct data and linking the correct swig_cast_info
  * structures together.
  *
- * The generated swig_type_info structures are assigned staticly to an initial 
+ * The generated swig_type_info structures are assigned staticly to an initial
  * array. We just loop through that array, and handle each type individually.
  * First we lookup if this type has been already loaded, and if so, use the
  * loaded structure instead of the generated one. Then we have to fill in the
@@ -25835,17 +25850,17 @@ static swig_command_info swig_commands[] = {
  * a column is one of the swig_cast_info structures for that type.
  * The cast_initial array is actually an array of arrays, because each row has
  * a variable number of columns. So to actually build the cast linked list,
- * we find the array of casts associated with the type, and loop through it 
+ * we find the array of casts associated with the type, and loop through it
  * adding the casts to the list. The one last trick we need to do is making
  * sure the type pointer in the swig_cast_info struct is correct.
  *
- * First off, we lookup the cast->type name to see if it is already loaded. 
+ * First off, we lookup the cast->type name to see if it is already loaded.
  * There are three cases to handle:
  *  1) If the cast->type has already been loaded AND the type we are adding
  *     casting info to has not been loaded (it is in this module), THEN we
  *     replace the cast->type pointer with the type pointer that has already
  *     been loaded.
- *  2) If BOTH types (the one we are adding casting info to, and the 
+ *  2) If BOTH types (the one we are adding casting info to, and the
  *     cast->type) are loaded, THEN the cast info has already been loaded by
  *     the previous module so we just ignore it.
  *  3) Finally, if cast->type has not already been loaded, then we add that
@@ -25871,8 +25886,6 @@ SWIG_InitializeModule(void *clientdata) {
   swig_module_info *module_head, *iter;
   int found, init;
   
-  clientdata = clientdata;
-  
   /* check to see if the circular list has been setup, if not, set it up */
   if (swig_module.next==0) {
     /* Initialize the swig_module */
@@ -25910,7 +25923,7 @@ SWIG_InitializeModule(void *clientdata) {
     module_head->next = &swig_module;
   }
   
-  /* When multiple interpeters are used, a module could have already been initialized in
+  /* When multiple interpreters are used, a module could have already been initialized in
        a different interpreter, but not yet have a pointer in this interpreter.
        In this case, we do not want to continue adding types... everything should be
        set up already */
@@ -26063,7 +26076,7 @@ XS(SWIG_init) {
   
   /* Install commands */
   for (i = 0; swig_commands[i].name; i++) {
-    // Casts only needed for Perl < 5.10.
+    /* Casts only needed for Perl < 5.10. */
 #ifdef __cplusplus
     newXS(const_cast<char*>(swig_commands[i].name), swig_commands[i].wrapper, const_cast<char*>(__FILE__));
 #else
@@ -26109,452 +26122,452 @@ XS(SWIG_init) {
     SvREADONLY_on(sv);
   }
   
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "wkb25DBit", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0x80000000)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "wkb25Bit", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0x80000000)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "wkbUnknown", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "wkbPoint", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(1)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "wkbLineString", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(2)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "wkbPolygon", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(3)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "wkbMultiPoint", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(4)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "wkbMultiLineString", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(5)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "wkbMultiPolygon", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(6)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "wkbGeometryCollection", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(7)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "wkbCircularString", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(8)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "wkbCompoundCurve", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(9)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "wkbCurvePolygon", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(10)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "wkbMultiCurve", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(11)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "wkbMultiSurface", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(12)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "wkbNone", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(100)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "wkbLinearRing", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(101)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "wkbCircularStringZ", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(1008)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "wkbCompoundCurveZ", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(1009)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "wkbCurvePolygonZ", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(1010)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "wkbMultiCurveZ", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(1011)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "wkbMultiSurfaceZ", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(1012)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "wkbPoint25D", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0x80000001)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "wkbLineString25D", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0x80000002)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "wkbPolygon25D", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0x80000003)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "wkbMultiPoint25D", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0x80000004)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "wkbMultiLineString25D", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0x80000005)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "wkbMultiPolygon25D", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0x80000006)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "wkbGeometryCollection25D", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0x80000007)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OFTInteger", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OFTIntegerList", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(1)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OFTReal", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(2)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OFTRealList", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(3)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OFTString", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(4)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OFTStringList", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(5)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OFTWideString", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(6)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OFTWideStringList", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(7)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OFTBinary", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(8)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OFTDate", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(9)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OFTTime", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(10)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OFTDateTime", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(11)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OFTInteger64", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(12)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OFTInteger64List", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(13)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OFSTNone", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OFSTBoolean", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(1)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OFSTInt16", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(2)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OFSTFloat32", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(3)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OJUndefined", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OJLeft", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(1)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OJRight", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(2)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "wkbXDR", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "wkbNDR", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(1)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "NullFID", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(-1)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "ALTER_NAME_FLAG", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(1)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "ALTER_TYPE_FLAG", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(2)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "ALTER_WIDTH_PRECISION_FLAG", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(4)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "ALTER_NULLABLE_FLAG", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(8)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "ALTER_DEFAULT_FLAG", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(16)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "ALTER_ALL_FLAG", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(1+2+4+8+16)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "F_VAL_NULL", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0x00000001)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "F_VAL_GEOM_TYPE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0x00000002)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "F_VAL_WIDTH", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0x00000004)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "F_VAL_ALLOW_NULL_WHEN_DEFAULT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0x00000008)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "F_VAL_ALL", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0xFFFFFFFF)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OLCRandomRead", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("RandomRead"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OLCSequentialWrite", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("SequentialWrite"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OLCRandomWrite", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("RandomWrite"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OLCFastSpatialFilter", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("FastSpatialFilter"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OLCFastFeatureCount", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("FastFeatureCount"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OLCFastGetExtent", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("FastGetExtent"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OLCCreateField", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("CreateField"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OLCDeleteField", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("DeleteField"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OLCReorderFields", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("ReorderFields"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OLCAlterFieldDefn", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("AlterFieldDefn"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OLCTransactions", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Transactions"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OLCDeleteFeature", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("DeleteFeature"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OLCFastSetNextByIndex", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("FastSetNextByIndex"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OLCStringsAsUTF8", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("StringsAsUTF8"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OLCIgnoreFields", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("IgnoreFields"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OLCCreateGeomField", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("CreateGeomField"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OLCCurveGeometries", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("CurveGeometries"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "ODsCCreateLayer", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("CreateLayer"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "ODsCDeleteLayer", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("DeleteLayer"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "ODsCCreateGeomFieldAfterCreateLayer", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("CreateGeomFieldAfterCreateLayer"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "ODsCCurveGeometries", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("CurveGeometries"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "ODsCTransactions", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Transactions"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "ODsCEmulatedTransactions", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("EmulatedTransactions"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "ODrCCreateDataSource", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("CreateDataSource"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "ODrCDeleteDataSource", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("DeleteDataSource"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "OLMD_FID64", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("OLMD_FID64"));
     SvREADONLY_on(sv);
@@ -26576,7 +26589,7 @@ XS(SWIG_init) {
   SWIG_TypeClientData(SWIGTYPE_p_OGRFieldDefnShadow, (void*) "Geo::OGR::FieldDefn");
   SWIG_TypeClientData(SWIGTYPE_p_OGRGeomFieldDefnShadow, (void*) "Geo::OGR::GeomFieldDefn");
   SWIG_TypeClientData(SWIGTYPE_p_OGRGeometryShadow, (void*) "Geo::OGR::Geometry");
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "TermProgress", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_NewFunctionPtrObj((void *)(int (*)(double,char const *,void *))(GDALTermProgress), SWIGTYPE_p_f_double_p_q_const__char_p_void__int));
     SvREADONLY_on(sv);
diff --git a/swig/perl/osr_wrap.cpp b/swig/perl/osr_wrap.cpp
index 81ca7a1..cd05df1 100644
--- a/swig/perl/osr_wrap.cpp
+++ b/swig/perl/osr_wrap.cpp
@@ -1,11 +1,11 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
- * 
- * This file is not intended to be easily readable and contains a number of 
+ * Version 2.0.12
+ *
+ * This file is not intended to be easily readable and contains a number of
  * coding conventions designed to improve portability and efficiency. Do not make
- * changes to this file unless you know what you are doing--modify the SWIG 
- * interface file instead. 
+ * changes to this file unless you know what you are doing--modify the SWIG
+ * interface file instead.
  * ----------------------------------------------------------------------------- */
 
 #define SWIGPERL
@@ -66,28 +66,28 @@ template <typename T> T SwigValueInit() {
 #ifndef SWIGUNUSED
 # if defined(__GNUC__)
 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#     define SWIGUNUSED __attribute__ ((__unused__))
 #   else
 #     define SWIGUNUSED
 #   endif
 # elif defined(__ICC)
-#   define SWIGUNUSED __attribute__ ((__unused__)) 
+#   define SWIGUNUSED __attribute__ ((__unused__))
 # else
-#   define SWIGUNUSED 
+#   define SWIGUNUSED
 # endif
 #endif
 
 #ifndef SWIG_MSC_UNSUPPRESS_4505
 # if defined(_MSC_VER)
 #   pragma warning(disable : 4505) /* unreferenced local function has been removed */
-# endif 
+# endif
 #endif
 
 #ifndef SWIGUNUSEDPARM
 # ifdef __cplusplus
 #   define SWIGUNUSEDPARM(p)
 # else
-#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
 # endif
 #endif
 
@@ -130,7 +130,7 @@ template <typename T> T SwigValueInit() {
 #   define SWIGSTDCALL __stdcall
 # else
 #   define SWIGSTDCALL
-# endif 
+# endif
 #endif
 
 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
@@ -168,7 +168,7 @@ template <typename T> T SwigValueInit() {
   You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
   creating a static or dynamic library from the SWIG runtime code.
   In 99.9% of the cases, SWIG just needs to declare them as 'static'.
-  
+
   But only do this if strictly necessary, ie, if you have problems
   with your compiler or suchlike.
 */
@@ -194,16 +194,16 @@ template <typename T> T SwigValueInit() {
 #define SWIG_POINTER_OWN           0x1
 
 
-/* 
+/*
    Flags/methods for returning states.
-   
-   The SWIG conversion methods, as ConvertPtr, return an integer 
+
+   The SWIG conversion methods, as ConvertPtr, return an integer
    that tells if the conversion was successful or not. And if not,
    an error code can be returned (see swigerrors.swg for the codes).
-   
+
    Use the following macros/flags to set or process the returning
    states.
-   
+
    In old versions of SWIG, code such as the following was usually written:
 
      if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
@@ -236,23 +236,23 @@ template <typename T> T SwigValueInit() {
     } else {
       // fail code
     }
-    
+
    I.e., now SWIG_ConvertPtr can return new objects and you can
    identify the case and take care of the deallocation. Of course that
    also requires SWIG_ConvertPtr to return new result values, such as
 
-      int SWIG_ConvertPtr(obj, ptr,...) {         
-        if (<obj is ok>) {			       
-          if (<need new object>) {		       
-            *ptr = <ptr to new allocated object>; 
-            return SWIG_NEWOBJ;		       
-          } else {				       
-            *ptr = <ptr to old object>;	       
-            return SWIG_OLDOBJ;		       
-          } 				       
-        } else {				       
-          return SWIG_BADOBJ;		       
-        }					       
+      int SWIG_ConvertPtr(obj, ptr,...) {
+        if (<obj is ok>) {
+          if (<need new object>) {
+            *ptr = <ptr to new allocated object>;
+            return SWIG_NEWOBJ;
+          } else {
+            *ptr = <ptr to old object>;
+            return SWIG_OLDOBJ;
+          }
+        } else {
+          return SWIG_BADOBJ;
+        }
       }
 
    Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
@@ -266,17 +266,17 @@ template <typename T> T SwigValueInit() {
        int fooi(int);
 
    and you call
- 
+
       food(1)   // cast rank '1'  (1 -> 1.0)
       fooi(1)   // cast rank '0'
 
    just use the SWIG_AddCast()/SWIG_CheckState()
 */
 
-#define SWIG_OK                    (0) 
+#define SWIG_OK                    (0)
 #define SWIG_ERROR                 (-1)
 #define SWIG_IsOK(r)               (r >= 0)
-#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  
+#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)
 
 /* The CastRankLimit says how many bits are used for the cast rank */
 #define SWIG_CASTRANKLIMIT         (1 << 8)
@@ -307,14 +307,14 @@ template <typename T> T SwigValueInit() {
 #  endif
 #  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
 #  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
-SWIGINTERNINLINE int SWIG_AddCast(int r) { 
+SWIGINTERNINLINE int SWIG_AddCast(int r) {
   return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
 }
-SWIGINTERNINLINE int SWIG_CheckState(int r) { 
-  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
+SWIGINTERNINLINE int SWIG_CheckState(int r) {
+  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
 }
 #else /* no cast-rank mode */
-#  define SWIG_AddCast
+#  define SWIG_AddCast(r) (r)
 #  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
 #endif
 
@@ -358,7 +358,7 @@ typedef struct swig_module_info {
   void                    *clientdata;		/* Language specific module data */
 } swig_module_info;
 
-/* 
+/*
   Compare two type names skipping the space characters, therefore
   "char*" == "char *" and "Class<int>" == "Class<int >", etc.
 
@@ -378,18 +378,18 @@ SWIG_TypeNameComp(const char *f1, const char *l1,
 
 /*
   Check type equivalence in a name list like <name1>|<name2>|...
-  Return 0 if not equal, 1 if equal
+  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
 */
 SWIGRUNTIME int
-SWIG_TypeEquiv(const char *nb, const char *tb) {
-  int equiv = 0;
+SWIG_TypeCmp(const char *nb, const char *tb) {
+  int equiv = 1;
   const char* te = tb + strlen(tb);
   const char* ne = nb;
-  while (!equiv && *ne) {
+  while (equiv != 0 && *ne) {
     for (nb = ne; *ne; ++ne) {
       if (*ne == '|') break;
     }
-    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    equiv = SWIG_TypeNameComp(nb, ne, tb, te);
     if (*ne) ++ne;
   }
   return equiv;
@@ -397,24 +397,13 @@ SWIG_TypeEquiv(const char *nb, const char *tb) {
 
 /*
   Check type equivalence in a name list like <name1>|<name2>|...
-  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
+  Return 0 if not equal, 1 if equal
 */
 SWIGRUNTIME int
-SWIG_TypeCompare(const char *nb, const char *tb) {
-  int equiv = 0;
-  const char* te = tb + strlen(tb);
-  const char* ne = nb;
-  while (!equiv && *ne) {
-    for (nb = ne; *ne; ++ne) {
-      if (*ne == '|') break;
-    }
-    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
-    if (*ne) ++ne;
-  }
-  return equiv;
+SWIG_TypeEquiv(const char *nb, const char *tb) {
+  return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
 }
 
-
 /*
   Check the typename
 */
@@ -442,7 +431,7 @@ SWIG_TypeCheck(const char *c, swig_type_info *ty) {
   return 0;
 }
 
-/* 
+/*
   Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
 */
 SWIGRUNTIME swig_cast_info *
@@ -477,7 +466,7 @@ SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
   return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
 }
 
-/* 
+/*
    Dynamic pointer casting. Down an inheritance hierarchy
 */
 SWIGRUNTIME swig_type_info *
@@ -521,7 +510,7 @@ SWIG_TypePrettyName(const swig_type_info *type) {
     return type->name;
 }
 
-/* 
+/*
    Set the clientdata field for a type
 */
 SWIGRUNTIME void
@@ -529,14 +518,14 @@ SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
   swig_cast_info *cast = ti->cast;
   /* if (ti->clientdata == clientdata) return; */
   ti->clientdata = clientdata;
-  
+
   while (cast) {
     if (!cast->converter) {
       swig_type_info *tc = cast->type;
       if (!tc->clientdata) {
 	SWIG_TypeClientData(tc, clientdata);
       }
-    }    
+    }
     cast = cast->next;
   }
 }
@@ -545,18 +534,18 @@ SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
   SWIG_TypeClientData(ti, clientdata);
   ti->owndata = 1;
 }
-  
+
 /*
   Search for a swig_type_info structure only by mangled name
   Search is a O(log #types)
-  
-  We start searching at module start, and finish searching when start == end.  
+
+  We start searching at module start, and finish searching when start == end.
   Note: if start == end at the beginning of the function, we go all the way around
   the circular list.
 */
 SWIGRUNTIME swig_type_info *
-SWIG_MangledTypeQueryModule(swig_module_info *start, 
-                            swig_module_info *end, 
+SWIG_MangledTypeQueryModule(swig_module_info *start,
+                            swig_module_info *end,
 		            const char *name) {
   swig_module_info *iter = start;
   do {
@@ -565,11 +554,11 @@ SWIG_MangledTypeQueryModule(swig_module_info *start,
       register size_t r = iter->size - 1;
       do {
 	/* since l+r >= 0, we can (>> 1) instead (/ 2) */
-	register size_t i = (l + r) >> 1; 
+	register size_t i = (l + r) >> 1;
 	const char *iname = iter->types[i]->name;
 	if (iname) {
 	  register int compare = strcmp(name, iname);
-	  if (compare == 0) {	    
+	  if (compare == 0) {
 	    return iter->types[i];
 	  } else if (compare < 0) {
 	    if (i) {
@@ -594,14 +583,14 @@ SWIG_MangledTypeQueryModule(swig_module_info *start,
   Search for a swig_type_info structure for either a mangled name or a human readable name.
   It first searches the mangled names of the types, which is a O(log #types)
   If a type is not found it then searches the human readable names, which is O(#types).
-  
-  We start searching at module start, and finish searching when start == end.  
+
+  We start searching at module start, and finish searching when start == end.
   Note: if start == end at the beginning of the function, we go all the way around
   the circular list.
 */
 SWIGRUNTIME swig_type_info *
-SWIG_TypeQueryModule(swig_module_info *start, 
-                     swig_module_info *end, 
+SWIG_TypeQueryModule(swig_module_info *start,
+                     swig_module_info *end,
 		     const char *name) {
   /* STEP 1: Search the name field using binary search */
   swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
@@ -620,12 +609,12 @@ SWIG_TypeQueryModule(swig_module_info *start,
       iter = iter->next;
     } while (iter != end);
   }
-  
+
   /* neither found a match */
   return 0;
 }
 
-/* 
+/*
    Pack binary data into a string
 */
 SWIGRUNTIME char *
@@ -641,7 +630,7 @@ SWIG_PackData(char *c, void *ptr, size_t sz) {
   return c;
 }
 
-/* 
+/*
    Unpack binary data from a string
 */
 SWIGRUNTIME const char *
@@ -655,21 +644,21 @@ SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
       uu = ((d - '0') << 4);
     else if ((d >= 'a') && (d <= 'f'))
       uu = ((d - ('a'-10)) << 4);
-    else 
+    else
       return (char *) 0;
     d = *(c++);
     if ((d >= '0') && (d <= '9'))
       uu |= (d - '0');
     else if ((d >= 'a') && (d <= 'f'))
       uu |= (d - ('a'-10));
-    else 
+    else
       return (char *) 0;
     *u = uu;
   }
   return c;
 }
 
-/* 
+/*
    Pack 'void *' into a string buffer.
 */
 SWIGRUNTIME char *
@@ -729,18 +718,18 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
 #endif
 
 /*  Errors in SWIG */
-#define  SWIG_UnknownError    	   -1 
-#define  SWIG_IOError        	   -2 
-#define  SWIG_RuntimeError   	   -3 
-#define  SWIG_IndexError     	   -4 
-#define  SWIG_TypeError      	   -5 
-#define  SWIG_DivisionByZero 	   -6 
-#define  SWIG_OverflowError  	   -7 
-#define  SWIG_SyntaxError    	   -8 
-#define  SWIG_ValueError     	   -9 
+#define  SWIG_UnknownError    	   -1
+#define  SWIG_IOError        	   -2
+#define  SWIG_RuntimeError   	   -3
+#define  SWIG_IndexError     	   -4
+#define  SWIG_TypeError      	   -5
+#define  SWIG_DivisionByZero 	   -6
+#define  SWIG_OverflowError  	   -7
+#define  SWIG_SyntaxError    	   -8
+#define  SWIG_ValueError     	   -9
 #define  SWIG_SystemError    	   -10
 #define  SWIG_AttributeError 	   -11
-#define  SWIG_MemoryError    	   -12 
+#define  SWIG_MemoryError    	   -12
 #define  SWIG_NullReferenceError   -13
 
 
@@ -925,7 +914,7 @@ SWIG_Perl_ErrorType(int code) {
 
 /* Runtime API */
 
-#define SWIG_GetModule(clientdata)                      SWIG_Perl_GetModule()
+#define SWIG_GetModule(clientdata)                      SWIG_Perl_GetModule(clientdata)
 #define SWIG_SetModule(clientdata, pointer)             SWIG_Perl_SetModule(pointer)
 
 
@@ -1362,7 +1351,7 @@ SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, i
 
 
 SWIGRUNTIME swig_module_info *
-SWIG_Perl_GetModule(void) {
+SWIG_Perl_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
   static void *type_pointer = (void *)0;
   SV *pointer;
 
@@ -1456,9 +1445,6 @@ SWIG_Perl_SetModule(swig_module_info *module) {
 #ifdef eof
   #undef eof
 #endif
-#ifdef bool
-  #undef bool
-#endif
 #ifdef close
   #undef close
 #endif
@@ -1499,6 +1485,14 @@ SWIG_Perl_SetModule(swig_module_info *module) {
   #undef stat
 #endif
 
+#ifdef bool
+  /* Leave if macro is from C99 stdbool.h */
+  #ifndef __bool_true_false_are_defined
+    #undef bool
+  #endif
+#endif
+
+
 
 
 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
@@ -1532,7 +1526,7 @@ static swig_module_info swig_module = {swig_types, 8, 0, 0, 0, 0};
 #define SWIG_name   "Geo::OSRc::boot_Geo__OSR"
 #define SWIG_prefix "Geo::OSRc::"
 
-#define SWIGVERSION 0x020007 
+#define SWIGVERSION 0x020012 
 #define SWIG_VERSION SWIGVERSION
 
 
@@ -13258,18 +13252,18 @@ static swig_command_info swig_commands[] = {
 };
 /* -----------------------------------------------------------------------------
  * Type initialization:
- * This problem is tough by the requirement that no dynamic 
- * memory is used. Also, since swig_type_info structures store pointers to 
+ * This problem is tough by the requirement that no dynamic
+ * memory is used. Also, since swig_type_info structures store pointers to
  * swig_cast_info structures and swig_cast_info structures store pointers back
- * to swig_type_info structures, we need some lookup code at initialization. 
- * The idea is that swig generates all the structures that are needed. 
- * The runtime then collects these partially filled structures. 
- * The SWIG_InitializeModule function takes these initial arrays out of 
+ * to swig_type_info structures, we need some lookup code at initialization.
+ * The idea is that swig generates all the structures that are needed.
+ * The runtime then collects these partially filled structures.
+ * The SWIG_InitializeModule function takes these initial arrays out of
  * swig_module, and does all the lookup, filling in the swig_module.types
  * array with the correct data and linking the correct swig_cast_info
  * structures together.
  *
- * The generated swig_type_info structures are assigned staticly to an initial 
+ * The generated swig_type_info structures are assigned staticly to an initial
  * array. We just loop through that array, and handle each type individually.
  * First we lookup if this type has been already loaded, and if so, use the
  * loaded structure instead of the generated one. Then we have to fill in the
@@ -13279,17 +13273,17 @@ static swig_command_info swig_commands[] = {
  * a column is one of the swig_cast_info structures for that type.
  * The cast_initial array is actually an array of arrays, because each row has
  * a variable number of columns. So to actually build the cast linked list,
- * we find the array of casts associated with the type, and loop through it 
+ * we find the array of casts associated with the type, and loop through it
  * adding the casts to the list. The one last trick we need to do is making
  * sure the type pointer in the swig_cast_info struct is correct.
  *
- * First off, we lookup the cast->type name to see if it is already loaded. 
+ * First off, we lookup the cast->type name to see if it is already loaded.
  * There are three cases to handle:
  *  1) If the cast->type has already been loaded AND the type we are adding
  *     casting info to has not been loaded (it is in this module), THEN we
  *     replace the cast->type pointer with the type pointer that has already
  *     been loaded.
- *  2) If BOTH types (the one we are adding casting info to, and the 
+ *  2) If BOTH types (the one we are adding casting info to, and the
  *     cast->type) are loaded, THEN the cast info has already been loaded by
  *     the previous module so we just ignore it.
  *  3) Finally, if cast->type has not already been loaded, then we add that
@@ -13315,8 +13309,6 @@ SWIG_InitializeModule(void *clientdata) {
   swig_module_info *module_head, *iter;
   int found, init;
   
-  clientdata = clientdata;
-  
   /* check to see if the circular list has been setup, if not, set it up */
   if (swig_module.next==0) {
     /* Initialize the swig_module */
@@ -13354,7 +13346,7 @@ SWIG_InitializeModule(void *clientdata) {
     module_head->next = &swig_module;
   }
   
-  /* When multiple interpeters are used, a module could have already been initialized in
+  /* When multiple interpreters are used, a module could have already been initialized in
        a different interpreter, but not yet have a pointer in this interpreter.
        In this case, we do not want to continue adding types... everything should be
        set up already */
@@ -13507,7 +13499,7 @@ XS(SWIG_init) {
   
   /* Install commands */
   for (i = 0; swig_commands[i].name; i++) {
-    // Casts only needed for Perl < 5.10.
+    /* Casts only needed for Perl < 5.10. */
 #ifdef __cplusplus
     newXS(const_cast<char*>(swig_commands[i].name), swig_commands[i].wrapper, const_cast<char*>(__FILE__));
 #else
@@ -13553,807 +13545,807 @@ XS(SWIG_init) {
     SvREADONLY_on(sv);
   }
   
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_WKT_WGS84", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],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/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_ALBERS_CONIC_EQUAL_AREA", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Albers_Conic_Equal_Area"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_AZIMUTHAL_EQUIDISTANT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Azimuthal_Equidistant"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_CASSINI_SOLDNER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Cassini_Soldner"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_CYLINDRICAL_EQUAL_AREA", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Cylindrical_Equal_Area"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_BONNE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Bonne"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_ECKERT_I", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Eckert_I"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_ECKERT_II", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Eckert_II"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_ECKERT_III", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Eckert_III"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_ECKERT_IV", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Eckert_IV"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_ECKERT_V", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Eckert_V"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_ECKERT_VI", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Eckert_VI"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_EQUIDISTANT_CONIC", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Equidistant_Conic"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_EQUIRECTANGULAR", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Equirectangular"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_GALL_STEREOGRAPHIC", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Gall_Stereographic"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_GAUSSSCHREIBERTMERCATOR", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Gauss_Schreiber_Transverse_Mercator"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_GEOSTATIONARY_SATELLITE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Geostationary_Satellite"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_GOODE_HOMOLOSINE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Goode_Homolosine"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_IGH", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Interrupted_Goode_Homolosine"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_GNOMONIC", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Gnomonic"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_HOTINE_OBLIQUE_MERCATOR_AZIMUTH_CENTER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Hotine_Oblique_Mercator_Azimuth_Center"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_HOTINE_OBLIQUE_MERCATOR", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Hotine_Oblique_Mercator"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_HOTINE_OBLIQUE_MERCATOR_TWO_POINT_NATURAL_ORIGIN", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Hotine_Oblique_Mercator_Two_Point_Natural_Origin"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_LABORDE_OBLIQUE_MERCATOR", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Laborde_Oblique_Mercator"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_LAMBERT_CONFORMAL_CONIC_1SP", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Lambert_Conformal_Conic_1SP"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_LAMBERT_CONFORMAL_CONIC_2SP", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Lambert_Conformal_Conic_2SP"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_LAMBERT_CONFORMAL_CONIC_2SP_BELGIUM", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Lambert_Conformal_Conic_2SP_Belgium"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_LAMBERT_AZIMUTHAL_EQUAL_AREA", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Lambert_Azimuthal_Equal_Area"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_MERCATOR_1SP", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Mercator_1SP"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_MERCATOR_2SP", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Mercator_2SP"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_MERCATOR_AUXILIARY_SPHERE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Mercator_Auxiliary_Sphere"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_MILLER_CYLINDRICAL", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Miller_Cylindrical"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_MOLLWEIDE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Mollweide"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_NEW_ZEALAND_MAP_GRID", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("New_Zealand_Map_Grid"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_OBLIQUE_STEREOGRAPHIC", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Oblique_Stereographic"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_ORTHOGRAPHIC", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Orthographic"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_POLAR_STEREOGRAPHIC", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Polar_Stereographic"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_POLYCONIC", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Polyconic"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_ROBINSON", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Robinson"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_SINUSOIDAL", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Sinusoidal"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_STEREOGRAPHIC", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Stereographic"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_SWISS_OBLIQUE_CYLINDRICAL", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Swiss_Oblique_Cylindrical"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_TRANSVERSE_MERCATOR", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Transverse_Mercator"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_TRANSVERSE_MERCATOR_SOUTH_ORIENTED", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Transverse_Mercator_South_Orientated"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_TRANSVERSE_MERCATOR_MI_21", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Transverse_Mercator_MapInfo_21"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_TRANSVERSE_MERCATOR_MI_22", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Transverse_Mercator_MapInfo_22"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_TRANSVERSE_MERCATOR_MI_23", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Transverse_Mercator_MapInfo_23"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_TRANSVERSE_MERCATOR_MI_24", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Transverse_Mercator_MapInfo_24"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_TRANSVERSE_MERCATOR_MI_25", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Transverse_Mercator_MapInfo_25"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_TUNISIA_MINING_GRID", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Tunisia_Mining_Grid"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_TWO_POINT_EQUIDISTANT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Two_Point_Equidistant"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_VANDERGRINTEN", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("VanDerGrinten"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_KROVAK", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Krovak"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_IMW_POLYCONIC", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("International_Map_of_the_World_Polyconic"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_WAGNER_I", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Wagner_I"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_WAGNER_II", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Wagner_II"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_WAGNER_III", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Wagner_III"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_WAGNER_IV", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Wagner_IV"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_WAGNER_V", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Wagner_V"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_WAGNER_VI", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Wagner_VI"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_WAGNER_VII", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Wagner_VII"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_QSC", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Quadrilateralized_Spherical_Cube"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_AITOFF", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Aitoff"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_WINKEL_I", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Winkel_I"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_WINKEL_II", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Winkel_II"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_WINKEL_TRIPEL", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Winkel_Tripel"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_CRASTER_PARABOLIC", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Craster_Parabolic"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_LOXIMUTHAL", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Loximuthal"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_QUARTIC_AUTHALIC", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Quartic_Authalic"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_CENTRAL_MERIDIAN", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("central_meridian"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_SCALE_FACTOR", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("scale_factor"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_STANDARD_PARALLEL_1", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("standard_parallel_1"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_STANDARD_PARALLEL_2", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("standard_parallel_2"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_PSEUDO_STD_PARALLEL_1", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("pseudo_standard_parallel_1"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_LONGITUDE_OF_CENTER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("longitude_of_center"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_LATITUDE_OF_CENTER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("latitude_of_center"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_LONGITUDE_OF_ORIGIN", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("longitude_of_origin"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_LATITUDE_OF_ORIGIN", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("latitude_of_origin"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_FALSE_EASTING", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("false_easting"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_FALSE_NORTHING", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("false_northing"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_AZIMUTH", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("azimuth"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_LONGITUDE_OF_POINT_1", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("longitude_of_point_1"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_LATITUDE_OF_POINT_1", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("latitude_of_point_1"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_LONGITUDE_OF_POINT_2", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("longitude_of_point_2"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_LATITUDE_OF_POINT_2", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("latitude_of_point_2"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_LONGITUDE_OF_POINT_3", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("longitude_of_point_3"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_LATITUDE_OF_POINT_3", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("latitude_of_point_3"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_RECTIFIED_GRID_ANGLE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("rectified_grid_angle"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_LANDSAT_NUMBER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("landsat_number"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_PATH_NUMBER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("path_number"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_PERSPECTIVE_POINT_HEIGHT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("perspective_point_height"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_SATELLITE_HEIGHT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("satellite_height"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_FIPSZONE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("fipszone"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_ZONE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("zone"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_LATITUDE_OF_1ST_POINT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Latitude_Of_1st_Point"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_LONGITUDE_OF_1ST_POINT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Longitude_Of_1st_Point"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_LATITUDE_OF_2ND_POINT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Latitude_Of_2nd_Point"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_LONGITUDE_OF_2ND_POINT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Longitude_Of_2nd_Point"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_METER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Meter"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_FOOT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Foot (International)"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_FOOT_CONV", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("0.3048"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_US_FOOT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Foot_US"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_US_FOOT_CONV", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("0.3048006096012192"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_NAUTICAL_MILE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Nautical Mile"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_NAUTICAL_MILE_CONV", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("1852.0"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_LINK", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Link"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_LINK_CONV", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("0.20116684023368047"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_CHAIN", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Chain"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_CHAIN_CONV", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("20.116684023368047"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_ROD", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Rod"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_ROD_CONV", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("5.02921005842012"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_LINK_Clarke", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Link_Clarke"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_LINK_Clarke_CONV", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("0.2011661949"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_KILOMETER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Kilometer"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_KILOMETER_CONV", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("1000."));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_DECIMETER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Decimeter"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_DECIMETER_CONV", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("0.1"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_CENTIMETER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Centimeter"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_CENTIMETER_CONV", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("0.01"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_MILLIMETER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Millimeter"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_MILLIMETER_CONV", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("0.001"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INTL_NAUT_MILE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Nautical_Mile_International"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INTL_NAUT_MILE_CONV", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("1852.0"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INTL_INCH", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Inch_International"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INTL_INCH_CONV", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("0.0254"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INTL_FOOT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Foot_International"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INTL_FOOT_CONV", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("0.3048"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INTL_YARD", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Yard_International"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INTL_YARD_CONV", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("0.9144"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INTL_STAT_MILE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Statute_Mile_International"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INTL_STAT_MILE_CONV", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("1609.344"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INTL_FATHOM", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Fathom_International"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INTL_FATHOM_CONV", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("1.8288"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INTL_CHAIN", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Chain_International"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INTL_CHAIN_CONV", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("20.1168"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INTL_LINK", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Link_International"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INTL_LINK_CONV", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("0.201168"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_US_INCH", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Inch_US_Surveyor"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_US_INCH_CONV", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("0.025400050800101603"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_US_YARD", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Yard_US_Surveyor"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_US_YARD_CONV", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("0.914401828803658"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_US_CHAIN", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Chain_US_Surveyor"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_US_CHAIN_CONV", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("20.11684023368047"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_US_STAT_MILE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Statute_Mile_US_Surveyor"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_US_STAT_MILE_CONV", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("1609.347218694437"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INDIAN_YARD", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Yard_Indian"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INDIAN_YARD_CONV", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("0.91439523"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INDIAN_FOOT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Foot_Indian"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INDIAN_FOOT_CONV", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("0.30479841"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INDIAN_CHAIN", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Chain_Indian"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INDIAN_CHAIN_CONV", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("20.11669506"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UA_DEGREE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("degree"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UA_DEGREE_CONV", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("0.0174532925199433"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_UA_RADIAN", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("radian"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_PM_GREENWICH", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("Greenwich"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_DN_NAD27", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("North_American_Datum_1927"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_DN_NAD83", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("North_American_Datum_1983"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_DN_WGS72", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("WGS_1972"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_DN_WGS84", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_FromCharPtr("WGS_1984"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_WGS84_SEMIMAJOR", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(6378137.0)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig2.0/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
     SV *sv = get_sv((char*) SWIG_prefix "SRS_WGS84_INVFLATTENING", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(298.257223563)));
     SvREADONLY_on(sv);
diff --git a/swig/perl/t/00.t b/swig/perl/t/00.t
index d9a0e18..9d3cfea 100644
--- a/swig/perl/t/00.t
+++ b/swig/perl/t/00.t
@@ -1,4 +1,6 @@
 use strict;
+use warnings;
+use Scalar::Util 'blessed';
 use Test::More qw(no_plan);
 BEGIN { use_ok('Geo::GDAL') };
 Geo::GDAL::PushFinderLocation('../../data');
@@ -127,7 +129,7 @@ $dataset->GeoTransform($transform);
 $transform = $dataset->GeoTransform();
 
 $dataset = Geo::GDAL::Driver('GTiff')->Create(Name => '/vsimem/test.gtiff');
-my @list = $dataset->GetFileList();
+ at list = $dataset->GetFileList();
 undef $dataset;
 
 @list = Geo::GDAL::VSIF::ReadDir('/vsimem/');
diff --git a/swig/perl/t/01.t b/swig/perl/t/01.t
index cdd8550..2312f9d 100644
--- a/swig/perl/t/01.t
+++ b/swig/perl/t/01.t
@@ -1,4 +1,5 @@
 use strict;
+use warnings;
 use Test::More qw(no_plan);
 BEGIN { use_ok('Geo::GDAL') };
 
@@ -73,5 +74,5 @@ ok($ext eq 'image/tiff', "MIMEType, got $ext");
 
 $dataset->GetDriver->CopyFiles('/vsimem/new.gtiff', '/vsimem/test.gtiff');
 $dataset->GetDriver->Rename('/vsimem/new2.gtiff', '/vsimem/new.gtiff');
-my %files = map {$_=>1} Geo::GDAL::VSIF::ReadDir('/vsimem/');
+%files = map {$_=>1} Geo::GDAL::VSIF::ReadDir('/vsimem/');
 ok(($files{'new2.gtiff'} and $files{'test.gtiff'}), "Rename");
diff --git a/swig/perl/t/02.t b/swig/perl/t/02.t
index 953c5b6..d07a825 100644
--- a/swig/perl/t/02.t
+++ b/swig/perl/t/02.t
@@ -1,4 +1,5 @@
 use strict;
+use warnings;
 use Test::More qw(no_plan);
 BEGIN { use_ok('Geo::GDAL') };
 
diff --git a/swig/perl/t/03.t b/swig/perl/t/03.t
index edede79..7acb27d 100644
--- a/swig/perl/t/03.t
+++ b/swig/perl/t/03.t
@@ -1,4 +1,5 @@
 use strict;
+use warnings;
 use Scalar::Util 'blessed';
 use Test::More qw(no_plan);
 BEGIN { use_ok('Geo::GDAL') };
@@ -27,7 +28,7 @@ ok($ds eq 'metri', "Unit");
 
 $band->ScaleAndOffset(0.1, 5);
 @list = $band->ScaleAndOffset();
-ok(($list[0] == 0.1 and $list[1] == 5), "ScaleAndOffset");
+ok((sprintf("%.1f", $list[0]) eq '0.1' and $list[1] == 5), "ScaleAndOffset");
 
 my $nr = $band->GetBandNumber;
 ok($nr == 1, "GetBandNumber");
@@ -40,7 +41,7 @@ ok((defined($rat) and blessed($rat) and $rat->isa('Geo::GDAL::RasterAttributeTab
 my $c = $band->ColorInterpretation;
 my %c = map {$_=>1} Geo::GDAL::Band::ColorInterpretations;
 ok($c{$c}, "Get ColorInterpretation");
-$c = (keys %c)[0];
+$c = 'BlueBand'; # (keys %c)[0]; setting RedBand leads to core dump in geotiff.cpp:4288 #6306
 $band->ColorInterpretation($c);
 ok($band->ColorInterpretation eq $c, "Set ColorInterpretation");
 
@@ -70,7 +71,7 @@ $dataset->AddBand('Float64');
 $band = $dataset->Band(3);
 $band->	Fill(123.45);
 $data = $band->ReadTile;
-ok($data->[0][0] == 123.45, "Fill with real");
+ok(sprintf("%.2f", $data->[0][0]) eq '123.45', "Fill with real");
 for my $row (@$data) {
 #    print "@$row\n";
 }
@@ -184,7 +185,7 @@ my $band2 = $dataset->Band(2);
 $band1->RegenerateOverviews([$band2]); #scalar resampling, subref callback, scalar callback_data
 $band1->RegenerateOverview($band2); #scalar resampling, subref callback, scalar callback_data
 
-my $c = $band1->GetOverviewCount;
+$c = $band1->GetOverviewCount;
 ok($c == 2, "GetOverviewCount, got $c");
 my $o = $band1->GetOverview(1);
 ok(defined($o), "GetOverview");
@@ -192,11 +193,10 @@ my $b = $band1->HasArbitraryOverviews;
 ok(!$b, "HasArbitraryOverviews");
 
 Geo::GDAL::VSIF::Unlink('/vsimem/test.gtiff');
-$dataset = Geo::GDAL::Driver('GTiff')->Create(Name => '/vsimem/test.gtiff', Type => 'Float64');
+$dataset = Geo::GDAL::Driver('GTiff')->Create(Name => '/vsimem/test.gtiff', Width => 256, Type => 'Float64');
 $band = $dataset->Band;
 
-my $data = $band->ReadTile;
-my ($min, $max);
+$data = $band->ReadTile;
 for my $y (0..@$data-1) {
     for my $x (0..@{$data->[$y]}-1) {
         $data->[$y][$x] = rand 10;
@@ -221,7 +221,8 @@ for (@$h) {
 }
 ok($sum == 256*256, "GetHistogram");
 ok(@$h == 11, "GetHistogram");
-my ($min, $max, $histogram) = $band->GetDefaultHistogram;
+my $histogram;
+($min, $max, $histogram) = $band->GetDefaultHistogram;
 ok(ref($histogram) eq 'ARRAY', "GetDefaultHistogram");
 eval {
     $band->SetDefaultHistogram($min, $max, $histogram);
@@ -231,7 +232,7 @@ ok(!$@, "SetDefaultHistogram");
 my $buf = $band->ReadRaster();
 my $pc = $band->PackCharacter;
 my @data = unpack("$pc*", $buf);
-my $n = @data;
+$n = @data;
 ok($n == 256*256, "ReadRaster");
 
 $buf = pack("$pc*", @data);
diff --git a/swig/perl/t/gdal.t b/swig/perl/t/gdal.t
index 574b7d5..98c2645 100644
--- a/swig/perl/t/gdal.t
+++ b/swig/perl/t/gdal.t
@@ -1,3 +1,5 @@
+use strict;
+use warnings;
 use Test::More qw(no_plan);
 BEGIN { use_ok('Geo::GDAL') };
 Geo::GDAL::PushFinderLocation('../../data');
@@ -109,7 +111,7 @@ if (0) {
     $b->FillNodata($r);
     #print STDERR "@$_\n" for (@{$b->ReadTile()});
 
-    my $histogram;
+    my @histogram;
     eval {
 	@histogram = $b->GetHistogram();
     };
@@ -117,7 +119,7 @@ if (0) {
     eval {
 	$b->SetDefaultHistogram(1,10,[0..255]);
     };
-    my ($min, $max);
+    my ($min, $max, $histogram);
     eval {
 	($min,$max,$histogram) = $b->GetDefaultHistogram();
     };
@@ -127,48 +129,16 @@ if (0) {
     };
     ok($#histogram == 19, "Histogram with parameters: @histogram");
 
-    my @o;
-    for (0..5) {
-	my $a = 0.1*$_;
-	push @o, "$a Generating Histogram 1";
-    }
-    my @out;
-    $callback = sub {
-    	      push @out, "@_";	
-    	      return $_[0] < 0.5 ? 1 : 0 };	
-    eval {
-	Geo::GDAL::ComputeMedianCutPCT($r,$g,$b,5,
-				       Geo::GDAL::ColorTable->new,
-				       $callback
-				       );
-    };
-    ok(is_deeply(\@out, \@o), "callback without callback_data");
-    @o = ();
-    for (0..5) {
-	my $a = 0.1*$_;
-	push @o, "$a Generating Histogram 6";
-    }
-    @out = ();
-    eval {
-	Geo::GDAL::ComputeMedianCutPCT($r,$g,$b,5,
-				       Geo::GDAL::ColorTable->new,
-				       $callback,6);
-    };
-    ok(is_deeply(\@out, \@o), "callback with callback_data");
-
-    # without callback only implicit test:
-    Geo::GDAL::ComputeMedianCutPCT($r,$g,$b,5,Geo::GDAL::ColorTable->new);
-
     Geo::GDAL::RegenerateOverview($r, $b, 'GAUSS');
     
     my $band = $r;
 
-    $colors = $band->ColorTable(Geo::GDAL::ColorTable->new);
-    @table = $colors->ColorTable([10,20,30,40],[20,20,30,40]);
+    my $colors = $band->ColorTable(Geo::GDAL::ColorTable->new);
+    my @table = $colors->ColorTable([10,20,30,40],[20,20,30,40]);
     for (@table) {
 	@$_ = (1,2,3,4) if $_->[0] == 10;
     }
-    @table2 = $colors->ColorTable(@table);
+    my @table2 = $colors->ColorTable(@table);
     ok($table[1]->[1] == 20, "colortable 1");
     ok($table2[0]->[2] == 3, "colortable 2");
 
@@ -194,6 +164,7 @@ if (0) {
 }
 
 {
+    my $DOWARN = 0;
     BEGIN { $SIG{'__WARN__'} = sub { warn $_[0] if $DOWARN } }
     my $r = Geo::GDAL::RasterAttributeTable->new;
     my @t = $r->FieldTypes;
@@ -208,6 +179,7 @@ if (0) {
             push @usages, $u;
 	}
     }
+    $DOWARN = 1;
     my $n = $r->GetColumnCount;
     my $n2 = @t * @u;
     ok($n == $n2, "create rat column");
@@ -239,13 +211,20 @@ if (0) {
 
 gdal_tests();
 
-$src = Geo::OSR::SpatialReference->new(EPSG => 2392);
+SKIP: {
+    my $src;
+    eval {
+        $src = Geo::OSR::SpatialReference->new(EPSG => 2392);
+    };
+    
+    skip "GDAL support files not found. Please set GDAL_DATA.", 1 if $@;
 
-$xml = $src->ExportToXML();
-$a = Geo::GDAL::ParseXMLString($xml);
-$xml = Geo::GDAL::SerializeXMLTree($a);
-$b = Geo::GDAL::ParseXMLString($xml);
-ok(is_deeply($a, $b), "xml parsing");
+    my $xml = $src->ExportToXML();
+    $a = Geo::GDAL::ParseXMLString($xml);
+    $xml = Geo::GDAL::SerializeXMLTree($a);
+    $b = Geo::GDAL::ParseXMLString($xml);
+    ok(is_deeply($a, $b), "xml parsing");
+}
 
 my @tmp = sort keys %available_driver;
 
diff --git a/swig/perl/t/ogr.t b/swig/perl/t/ogr.t
index 067e9e5..5e368a8 100644
--- a/swig/perl/t/ogr.t
+++ b/swig/perl/t/ogr.t
@@ -1,35 +1,10 @@
+use strict;
+use warnings;
 use Test::More qw(no_plan);
 BEGIN { use_ok('Geo::GDAL') };
 Geo::GDAL::PushFinderLocation('../../data');
 
-use strict;
-use vars qw/%available_driver %test_driver $loaded $verbose @types %pack_types @fails @tested_drivers/;
-
-$loaded = 1;
-
-$verbose = $ENV{VERBOSE};
-
-# tests:
-#
-# for pre-tested OGR drivers:
-#   Create datasource
-#   Create layer
-#   Create field
-#   Create geometry
-#   Open layer
-#   Open field
-#   Open geom
-#   Cmp points
-#
-# not yet tested
-#   transactions
-#   GEOS methods
-#   osr
-#   XML typemaps
-#
-# if verbose = 1, all operations (skip,fail,ok) are printed out
-
-system "rm -rf tmp_ds_*" unless $^O eq 'MSWin32';
+use vars qw/%test_driver $loaded $verbose @types %pack_types @fails @tested_drivers/;
 
 {
     my $l = Geo::OGR::Driver('Memory')->Create()->CreateLayer();
@@ -120,7 +95,7 @@ system "rm -rf tmp_ds_*" unless $^O eq 'MSWin32';
     # test the Points method
     my $g = Geo::OGR::Geometry->new( 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");
+    ok (sprintf("%.1f", $p->[0]) eq '1.1' && sprintf("%.1f", $p->[1]) eq '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");
@@ -176,6 +151,9 @@ system "rm -rf tmp_ds_*" unless $^O eq 'MSWin32';
     @test = $f->GetField('ilist');
     ok(is_deeply(\@test, [1,2,3]), 'integer list');
     @test = $f->GetField('rlist');
+    for (@test) {
+        $_ = sprintf("%.1f", $_);
+    }
     ok(is_deeply(\@test, [1.1,2.2,3.3]), 'double list');
     @test = $f->GetField('slist');
     ok(is_deeply(\@test, ['a','b','c']), 'string list');
@@ -284,8 +262,6 @@ for (@tmp) {
     push @types, $_;
 }
 
-ogr_tests($osr);
-
 my $methods = Geo::OSR::GetProjectionMethods;
 
 for my $method (@$methods) {
@@ -300,407 +276,3 @@ for my $method (@$methods) {
 	ok($defaultval ne '', "$method $parameter: GetProjectionMethodParamInfo defval");
     }
 }
-
- at tmp = sort keys %available_driver;
-
-if (@fails) {
-    print STDERR "\nUnexpected failures:\n", at fails;
-    #print STDERR "\nAvailable drivers were ",join(', ', at tmp),"\n";
-    #print STDERR "Drivers used in tests were: ",join(', ', at tested_drivers),"\n";
-} else {
-    #print STDERR "\nAvailable drivers were ",join(', ', at tmp),"\n";
-    #print STDERR "Drivers used in tests were: ",join(', ', at tested_drivers),"\n";
-}
-
-system "rm -rf tmp_ds_*" unless $^O eq 'MSWin32';
-
-###########################################
-#
-# only subs below
-#
-###########################################
-
-sub ogr_tests {
-    my($osr) = @_;
-    for my $driver (Geo::OGR::Drivers) {
-	my $name = $driver->{name};
-	
-	unless (defined $name) {
-	    $name = 'unnamed';
-	    my $i = 1;
-	    while ($available_driver{$name}) {
-		$name = 'unnamed '.$i;
-		$i++;
-	    }
-	}
-
-	$available_driver{$name} = 1;
-	mytest('skipped: not tested',undef,$name,'test'),next unless $test_driver{$name};
-	
-	if (!$driver->TestCapability('CreateDataSource')) {
-	    mytest('skipped: no capability',undef,$name,'datasource create');
-	    next;
-	}
-	
-	if ($name eq 'KML' or 
-	    $name eq 'S57' or 
-	    $name eq 'CSV' or 
-	    $name eq 'GML' or 
-	    $name eq 'PostgreSQL' or 
-	    $name =~ /^Interlis/ or 
-	    $name eq 'SQLite' or 
-	    $name eq 'MySQL') 
-	{
-	    mytest('skipped: apparently no capability',undef,$name,'datasource create');
-	    next;
-	}
-	
-	if ($name eq 'TIGER' or $name eq 'DGN') {
-	    mytest("skipped: can't create layers afterwards.",undef,$name,'datasource create');
-	    next;
-	}
-        if ($name eq 'ESRI Shapefile' or $name eq 'MapInfo File') {
-	    mytest("skipped",undef,$name,'datasource create');
-	    next;
-	}
-
-	push @tested_drivers,$name;
-
-	my @field_types = (qw/Integer IntegerList Real RealList String 
-			   StringList Binary/);
-	
-	if ($name eq 'ESRI Shapefile') {
-	    @field_types = (qw/Integer Real String/);
-	} elsif ($name eq 'MapInfo File') {
-	    @field_types = (qw/Integer Real String/);
-	}
-	
-	my $dir0 = $name;
-	$dir0 =~ s/ //g;
-	my $dir = "tmp_ds_$dir0";
-	system "mkdir $dir" unless $name eq 'Memory';
-	
-	my $datasource;
-	eval {
-	    $datasource = $driver->CreateDataSource($dir);
-	};
-	mytest($datasource,'no message',$name,'datasource create');
-	
-	next unless $datasource;
-	
-	for my $type (@types) {
-	    
-            print "$type\n";
-	    if ($type eq 'MultiPolygon' or $type =~ /Z/) {
-		mytest("skipped, no test yet",undef,$name,$type,'layer create');
-		next;
-	    }
-	    
-	    my $layer;
-	    eval {
-		$layer = $datasource->CreateLayer($type, $osr, $type);
-	    };
-	    mytest($layer,'no message',$name,$type,'layer create');
-	    
-	    next unless $layer;
-	    
-	    # create one field of each type
-	    
-	    for my $ft (@field_types) {
-		
-		my $column = Geo::OGR::FieldDefn->new($ft, $ft);
-		$column->SetWidth(5) if $ft eq 'Integer';
-		$layer->CreateField($column);
-		
-	    }
-	    
-	    {
-		my $schema = $layer->GetLayerDefn();
-		
-		my $i = 0;
-		for my $ft (@field_types) {
-		    
-		    my $column = $schema->GetFieldDefn($i++);
-		    my $n = $column->GetName;
-		    mytest($n eq $ft,"$n ne $ft",$name,$type,$ft,'field create');
-		    
-		}
-		
-		my $feature = new Geo::OGR::Feature($schema);
-		
-		my $t = $schema->GeometryType;
-                $t = 'Polygon' if $t eq 'Unknown';
-
-		my $geom = Geo::OGR::Geometry->new($t);
-		
-		if ($type eq 'MultiPoint') {
-
-		    for (0..1) {
-			my $g = Geo::OGR::Geometry->new('Point');
-			test_geom($g,$name,'Point','create');
-			$geom->AddGeometry($g);
-		    }
-
-		} elsif ($type eq 'MultiLineString') {
-
-		    for (0..1) {
-			my $g = Geo::OGR::Geometry->new('LineString');
-			test_geom($g,$name,'LineString','create');
-			$geom->AddGeometry($g);
-		    }
-
-		} else {
-		
-		    test_geom($geom,$name,$type,'create');
-
-		}
-		
-		$feature->SetGeometry($geom);
-		
-		$i = 0;
-		for my $ft (@field_types) {
-		    my $v = 2;
-		    $v = 'kaksi' if $ft eq 'String';
-		    $feature->SetField($i++,$v);
-		}
-		
-		$layer->CreateFeature($feature);
-		#$layer->SyncToDisk;
-		
-	    }
-	    
-	    undef $layer if $name ne 'Memory';
-	    
-	    # now open
-	    
-	    if ($name eq 'MemoryXX')
-	    {
-		mytest('skipped',undef,$name,$type,'layer open');
-		
-	    } else {
-		
-		undef $datasource if $name ne 'Memory';
-		
-		if ($name ne 'Memory') {
-		    eval {
-			    $datasource = Geo::OGR::Open($dir, 1);
-			    $layer = $datasource->GetLayerByName($type);
-		    };
-		    
-		    mytest($layer,'no message',$name,$type,"layer $type open");
-		    next unless $layer;
-		}
-		
-		# check to see if the fields exist and the types are the same
-		
-		my $schema = $layer->GetLayerDefn();
-		
-		my $i = 0;
-		for my $ft (@field_types) {
-		    my $column = $schema->GetFieldDefn($i++);
-		    my $n = $column->GetName;
-		    mytest($n eq $ft,"$n ne $ft",$name,$type,$ft,'GetName');
-		    my $t2 = $column->Type;
-		    mytest($ft eq $t2,"$ft ne $t2",$name,$type,$ft,'Type');
-		}
-		
-		if ($type eq 'Point' or $type eq 'LineString' or $type eq 'Polygon') {
-		    
-		    $layer->ResetReading;
-		    my $feature = $layer->GetNextFeature;
-		    
-		    mytest($feature,'GetFeature failed',$name,$type,'GetNextFeature');
-		    
-		    if ($feature) {
-			
-			my $geom = $feature->GetGeometryRef();
-			
-                        if (!$geom) {
-                        } elsif ($type eq 'Pointxx') {
-			    mytest('skipped',undef,$name,$type,'geom open');
-			} else {
-			    my $t = $type eq 'Unknown' ? 'Polygon' : $type;
-			    my $t2 = $geom->GeometryType;
-                       
-			    mytest($t eq $t2,"$t ne $t2",$name,$type,'geom open');
-
-			    if ($type eq 'MultiPoint') {
-
-				my $gn = $geom->GetGeometryCount;
-				mytest($gn == 2,"$gn != 2",$name,$type,'geom count');
-
-				for my $i (0..1) {
-				    my $g = $geom->GetGeometryRef($i);
-				    test_geom($g,$name,'Point','open');
-				}
-
-			    } elsif ($type eq 'MultiLineString') {
-
-				my $gn = $geom->GetGeometryCount;
-				mytest($gn == 2,"$gn != 2",$name,$type,'geom count');
-
-				for $i (0..1) {
-				    my $g = $geom->GetGeometryRef($i);
-				    test_geom($g,$name,'LineString','open');
-				}
-				
-			    } else {
-				test_geom($geom,$name,$type,'open');
-			    }
-			}
-			
-			my $i = 0;
-			for my $ft (@field_types) {
-			    next if $name eq 'Memory' and $ft ne 'Integer'; 
-			    #$feature->SetField($i++,2);
-			    my $f;
-			    if ($ft eq 'String') {
-				$f = $feature->GetField($i);
-				mytest($f eq 'kaksi',"$f ne 'kaksi'",$name,$type,"$ft GetField");
-			    } else {
-				$f = $feature->GetField($i);
-				mytest($f == 2,"$f != 2",$name,$type,"$ft GetField");
-				#$f = $feature->GetField($i);
-				#mytest($f == 2,"$f != 2",$name,$type,'GetField');
-			    }
-			    $i++;
-			}
-			
-		    }
-		} else {
-		    mytest('skipped',undef,$name,$type,'feature open');
-		}
-		
-		undef $layer;
-	    }
-	    
-	}
-		
-    }
-
-    # specific tests:
-
-    my $geom = Geo::OGR::Geometry->new('Point');
-    $geom->AddPoint(1,1);
-    ok($geom->GeometryType eq 'Point', "Add 2D Point");
-    $geom->AddPoint(1,1,1);
-    ok($geom->GeometryType eq 'Point25D', "Add 3D Point upgrades geom type");
-    
-}
-
-sub test_geom {
-    my($geom,$name,$type,$mode) = @_;
-
-    my $pc = $geom->GetPointCount;
-    my $gn = $geom->GetGeometryCount;
-    my $i = 0;
-
-    if ($type eq 'Point') {
-
-	if ($mode eq 'create') {
-	    $geom->AddPoint(1,1);
-	    $geom->SetPoint_2D(0,1,1);
-	    my @p = $geom->GetPoint;
-	    ok(is_deeply(\@p, [1,1]), "GetPoint");
-	} else {
-	    mytest($pc == 1,"$pc != 1",$name,$type,'point count');
-	    mytest($gn == 0,"$gn != 0",$name,$type,'geom count');
-	    my @xy = ($geom->GetX($i),$geom->GetY($i));
-	    mytest(cmp_ar(2,\@xy,[1,1]),"(@xy) != (1,1)",$name,$type,"get point");
-	}
-	
-    } elsif ($type eq 'LineString') {
-	
-	if ($mode eq 'create') {
-	    $geom->AddPoint(1,1);
-	    $geom->AddPoint(2,2);
-	} else {
-	    mytest($pc == 2,"$pc != 2",$name,$type,'point count');
-	    mytest($gn == 0,"$gn != 0",$name,$type,'geom count');
-	    my @xy = ($geom->GetX($i),$geom->GetY($i)); $i++;
-	    mytest(cmp_ar(2,\@xy,[1,1]),"(@xy) != (1,1)",$name,$type,"get point");
-	    @xy = ($geom->GetX($i),$geom->GetY($i));
-	    mytest(cmp_ar(2,\@xy,[2,2]),"(@xy) != (2,2)",$name,$type,"get point");
-	}
-
-    } elsif ($type eq 'Unknown' or $type eq 'Polygon') {
-
-	my @pts = ([1.1,1],[1.11,0],[0,0.2],[0,2.1],[1,1.23],[1.1,1]);
-
-	if ($mode eq 'create') {
-	    my $r = Geo::OGR::Geometry->new('LinearRing');
-	    pop @pts;
-	    my $n = @pts;
-	    for my $pt (@pts) {
-		$r->AddPoint(@$pt);
-	    }
-	    $pc = $r->GetPointCount;
-	    mytest($pc == $n,"$pc != $n",$name,$type,'point count pre');
-            $geom->AddGeometry($r);
-            $geom->CloseRings; # this adds the point we popped out
-            $n++;
-            $r = $geom->GetGeometryRef(0);
-            $pc = $r->GetPointCount;
-            for (0..$pc-1) {
-                my @p = $r->GetPoint($_);
-            }
-            mytest($pc == $n,"$pc != $n",$name,$type,'point count post 1');
-	} else {	       
-	    mytest($gn == 1,"$gn != 1",$name,$type,'geom count');
-	    my $r = $geom->GetGeometryRef(0);
-	    $pc = $r->GetPointCount;
-	    my $n = @pts;
-	    mytest($pc == $n,"$pc != $n",$name,$type,'point count post  2');
-	    for my $cxy (@pts) {
-		my @xy = ($r->GetX($i),$r->GetY($i)); $i++;
-		mytest(cmp_ar(2,\@xy,$cxy),"(@xy) != (@$cxy)",$name,$type,"get point $i");
-	    }
-	}
-
-    } else {
-	mytest('skipped',undef,$name,$type,'geom new/open');
-    }
-}
-
-sub cmp_ar {
-    my($n,$a1,$a2) = @_;
-    return 0 unless $n == @$a1;
-    return 0 unless $#$a1 == $#$a2;
-    for my $i (0..$#$a1) {
-	return 0 unless abs($a1->[$i] - $a2->[$i]) < 0.001;
-    }
-    return 1;
-}
-
-sub mytest {
-    my $test = shift;
-    my $msg = shift;
-    my $context = join(': ', at _);
-    ok($test, $context);
-    unless ($test) {
-	my $err = $msg;
-	if ($@) {
-	    $@ =~ s/\n/ /g;
-	    $@ =~ s/\s+$//;
-	    $@ =~ s/\s+/ /g;
-	    $@ =~ s/^\s+$//;
-	    $err = $@ ? "'$@'" : $msg;
-	}
-	$msg = "$context: $err: not ok\n";
-	push @fails,$msg;
-    } elsif ($test =~ /^skip/) {
-	$msg = "$context: $test.\n";
-    } else {
-	$msg = "$context: ok.\n";
-    }
-    print $msg if $verbose;
-    return $msg;
-}
-
-sub dumphash {
-    my $h = shift;
-    for (keys %$h) {
-	print "$_ $h->{$_}\n";
-    }
-}
-
diff --git a/swig/perl/t/osr.t b/swig/perl/t/osr.t
index 5db1134..858a662 100644
--- a/swig/perl/t/osr.t
+++ b/swig/perl/t/osr.t
@@ -1,9 +1,11 @@
+use strict;
+use warnings;
 use Test::More qw(no_plan);
 BEGIN { use_ok('Geo::GDAL') };
 Geo::GDAL::PushFinderLocation('../../data');
 
-$srs1 = Geo::OSR::SpatialReference->new(EPSG=>2936);
-$srs2 = Geo::OSR::SpatialReference->new(Text=>$srs1->AsText);
+my $srs1 = Geo::OSR::SpatialReference->new(EPSG=>2936);
+my $srs2 = Geo::OSR::SpatialReference->new(Text=>$srs1->AsText);
 
 ok($srs1->ExportToProj4 eq $srs2->ExportToProj4, "new EPSG, Text, Proj4");
 
diff --git a/swig/python/scripts/gdalmove.py b/swig/python/scripts/gdalmove.py
index 6daf177..c60c6a2 100755
--- a/swig/python/scripts/gdalmove.py
+++ b/swig/python/scripts/gdalmove.py
@@ -115,7 +115,7 @@ def move( filename, t_srs, s_srs=None, pixel_threshold = None ):
               (ur[1] - ul[1]) / ds.RasterXSize,
               (ll[1] - ul[1]) / ds.RasterYSize)
 
-    (x,inv_new_gt) = gdal.InvGeoTransform( new_gt )
+    inv_new_gt = gdal.InvGeoTransform( new_gt )
     
     # -------------------------------------------------------------------------
     #  Report results for the five locations.
@@ -171,10 +171,10 @@ def move( filename, t_srs, s_srs=None, pixel_threshold = None ):
         if this_error > max_error:
             max_error = this_error
 
-    update = 0
+    update = False
     if pixel_threshold is not None:
         if pixel_threshold > max_error:
-            update = 1
+            update = True
 
     # -------------------------------------------------------------------------
     # Apply the change coordinate system and geotransform.
@@ -208,8 +208,7 @@ gdalmove.py [-s_srs <srs_defn>] -t_srs <srs_defn>
 #############################################################################
 # Main
 
-if __name__ == '__main__':
-
+def main():
     # Default GDAL argument parsing.
     
     argv = gdal.GeneralCmdLineProcessor( sys.argv )
@@ -222,7 +221,6 @@ if __name__ == '__main__':
     # Script argument defaults
     s_srs = None
     t_srs = None
-    update=0
     filename = None
     pixel_threshold = None
 
@@ -264,3 +262,7 @@ if __name__ == '__main__':
 
 
     move( filename, t_srs, s_srs, pixel_threshold )
+
+
+if __name__ == '__main__':
+    main()
diff --git a/swig/python/setup.py b/swig/python/setup.py
index 84f4e9e..249874e 100644
--- a/swig/python/setup.py
+++ b/swig/python/setup.py
@@ -7,7 +7,7 @@
 # Howard Butler hobu.inc at gmail.com
 
 
-gdal_version = '2.0.1'
+gdal_version = '2.0.2'
 
 import sys
 import os

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



More information about the Pkg-grass-devel mailing list