[liblas] 02/03: Update to build against latest gdal (1.11.0)
Ross Gammon
ross-guest at moszumanska.debian.org
Thu Jul 31 20:08:21 UTC 2014
This is an automated email from the git hooks/post-receive script.
ross-guest pushed a commit to branch master
in repository liblas.
commit f1d740863685c766704fe5d785c7eb4873f980a4
Author: Ross Gammon <rossgammon at mail.dk>
Date: Thu Jul 31 21:32:43 2014 +0200
Update to build against latest gdal (1.11.0)
Commit cherry picked from upstream (from what will become liblas 1.8).
---
debian/patches/series | 1 +
debian/patches/update_gdal_geotiff.patch | 1796 ++++++++++++++++++++++++++++++
2 files changed, 1797 insertions(+)
diff --git a/debian/patches/series b/debian/patches/series
index f58753b..f7f8bed 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,4 @@ boost
soversion
fix_library_search
separator-typo
+update_gdal_geotiff.patch
diff --git a/debian/patches/update_gdal_geotiff.patch b/debian/patches/update_gdal_geotiff.patch
new file mode 100644
index 0000000..1e1026f
--- /dev/null
+++ b/debian/patches/update_gdal_geotiff.patch
@@ -0,0 +1,1796 @@
+From: Howard Butler <hobu.inc at gmail.com>
+Subject: [PATCH] update GDAL's GeoTIFF stuff to something more current
+Date: Tue, 10 Jun 2014 13:48:51 -0500
+
+Patch cherry-picked from upstream to prepare the way for the GDAL transition to 1.11.0.
+This commit will be part of LibLAS 1.8, but it may not be ready for a while, so it is
+being backported to LibLAS 1.7.
+Relevant Debian GIS Team discussion here:
+https://lists.debian.org/debian-gis/2014/07/msg00049.html
+
+Origin: upstream, https://github.com/libLAS/libLAS/commit/5a3361ea12ad8c946c6675b6f3e7370dd426a408
+Origin: upstream, https://github.com/libLAS/libLAS/commit/43e841f21fe90b1a35aa127c62e0ea1a96eb2df9
+
+---
+ src/gt_wkt_srs.cpp | 813 ++++++++++++++++++++++++++++++----------------
+ src/gt_wkt_srs.h | 4 +-
+ src/gt_wkt_srs_for_gdal.h | 18 +-
+ src/tifvsi.cpp | 55 ++--
+ src/tifvsi.h | 5 +-
+ 5 files changed, 590 insertions(+), 305 deletions(-)
+
+--- liblas.orig/src/gt_wkt_srs.cpp
++++ liblas/src/gt_wkt_srs.cpp
+@@ -1,15 +1,15 @@
+ /******************************************************************************
+- * $Id: gt_wkt_srs.cpp 21928 2011-03-11 03:31:28Z warmerdam $
++ * $Id$
+ *
+ * Project: GeoTIFF Driver
+ * Purpose: Implements translation between GeoTIFF normalized projection
+- * definitions and OpenGIS WKT SRS format. This code is
+- * deliberately GDAL free, and it is intended to be moved into
+- * libgeotiff someday if possible.
++ * definitions and OpenGIS WKT SRS format. This code is intended to
++ * be moved into libgeotiff someday if possible.
+ * Author: Frank Warmerdam, warmerdam at pobox.com
+ *
+ ******************************************************************************
+ * Copyright (c) 1999, Frank Warmerdam
++ * Copyright (c) 2008-2014, Even Rouault <even dot rouault at mines-paris dot org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+@@ -30,9 +30,10 @@
+ * DEALINGS IN THE SOFTWARE.
+ ****************************************************************************/
+
+-#include "cpl_serv.h"
+-#include "geo_tiffp.h"
+-#define CPL_ERROR_H_INCLUDED
++#include "cpl_error.h"
++#include "cpl_conv.h"
++#include "cpl_csv.h"
++#include "gdal_csv.h"
+
+ #include "geovalues.h"
+ #include "ogr_spatialref.h"
+@@ -44,60 +45,27 @@
+ #include "gt_wkt_srs_for_gdal.h"
+ #include "gt_citation.h"
+
+-CPL_CVSID("$Id: gt_wkt_srs.cpp 21928 2011-03-11 03:31:28Z warmerdam $")
++CPL_CVSID("$Id$")
+
+-CPL_C_START
+-#ifndef CPL_SERV_H_INTERNAL
+-/* Make VSIL_STRICT_ENFORCE active in DEBUG builds */
+-#ifdef DEBUG
+-#define VSIL_STRICT_ENFORCE
+-#endif
++#define ProjLinearUnitsInterpCorrectGeoKey 3059
+
+-#ifdef VSIL_STRICT_ENFORCE
+-typedef struct _VSILFILE VSILFILE;
+-#else
+-typedef FILE VSILFILE;
++#ifndef CT_HotineObliqueMercatorAzimuthCenter
++# define CT_HotineObliqueMercatorAzimuthCenter 9815
+ #endif
+
+-// ensure compatability with older libgeotiffs.
+ #if !defined(GTIFAtof)
+-# define GTIFAtof atof
++# define GTIFAtof CPLAtof
+ #endif
+
+-int CPL_DLL VSIFCloseL( VSILFILE * );
+-int CPL_DLL VSIUnlink( const char * );
+-VSILFILE CPL_DLL *VSIFileFromMemBuffer( const char *pszFilename,
+- GByte *pabyData,
+- GUIntBig nDataLength,
+- int bTakeOwnership );
+-GByte CPL_DLL *VSIGetMemFileBuffer( const char *pszFilename,
+- GUIntBig *pnDataLength,
+- int bUnlinkAndSeize );
+-
+-/* Those stuff are redefined in external libgeotiff cpl_serv.h */
+-/* as macros. Let's use GDAL functions instead */
+-/* E.Rouault : I'm wondering why we just don't #define CPL_SERV_H_INCLUDED */
+-/* at the beginning of this file to avoid cpl_serv.h to be used at all ??? */
+-
+-#undef CSVReadParseLine
+-char CPL_DLL **CSVReadParseLine( FILE *fp);
+-#undef CSLDestroy
+-void CPL_DLL CPL_STDCALL CSLDestroy(char **papszStrList);
+-#undef VSIFree
+-void CPL_DLL VSIFree( void * );
+-#undef CPLFree
+-#define CPLFree VSIFree
+-#undef CPLMalloc
+-void CPL_DLL *CPLMalloc( size_t );
+-#undef CPLCalloc
+-void CPL_DLL *CPLCalloc( size_t, size_t );
+-#undef CPLStrdup
+-char CPL_DLL *CPLStrdup( const char * );
+-
+-#endif /* CPL_SERV_H_INTERNAL */
++CPL_C_START
++void CPL_DLL LibgeotiffOneTimeInit();
++void LibgeotiffOneTimeCleanupMutex();
+
+ CPL_C_END
+
++// To remind myself not to use CPLString in this file!
++#define CPLString Please_do_not_use_CPLString_in_this_file
++
+ static const char *papszDatumEquiv[] =
+ {
+ "Militar_Geographische_Institut",
+@@ -119,6 +87,40 @@
+ #endif
+
+ /************************************************************************/
++/* LibgeotiffOneTimeInit() */
++/************************************************************************/
++
++static void* hMutex = NULL;
++
++void LibgeotiffOneTimeInit()
++{
++ static int bOneTimeInitDone = FALSE;
++ CPLMutexHolder oHolder( &hMutex);
++
++ if (bOneTimeInitDone)
++ return;
++
++ bOneTimeInitDone = TRUE;
++
++ // If linking with an external libgeotiff we hope this will call the
++ // SetCSVFilenameHook() in libgeotiff, not the one in gdal/port!
++ // SetCSVFilenameHook( GDALDefaultCSVFilename );
++}
++
++/************************************************************************/
++/* LibgeotiffOneTimeCleanupMutex() */
++/************************************************************************/
++
++void LibgeotiffOneTimeCleanupMutex()
++{
++ if( hMutex != NULL )
++ {
++ CPLDestroyMutex(hMutex);
++ hMutex = NULL;
++ }
++}
++
++/************************************************************************/
+ /* GTIFToCPLRecyleString() */
+ /* */
+ /* This changes a string from the libgeotiff heap to the GDAL */
+@@ -207,11 +209,11 @@
+ /************************************************************************/
+
+ /* For example:
+- GTCitationGeoKey (Ascii,215): "IMAGINE GeoTIFF Support\nCopyright 1991 - 2001 by ERDAS, Inc. All Rights Reserved\n@(#)$RCSfile$ $Revision: 21928 $ $Date: 2011-03-10 22:31:28 -0500 (Thu, 10 Mar 2011) $\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$ $Date$\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: 21928 $ $Date: 2011-03-10 22:31:28 -0500 (Thu, 10 Mar 2011) $\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$ $Date$\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: 21928 $ $Date: 2011-03-10 22:31:28 -0500 (Thu, 10 Mar 2011) $\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$ $Date$\nUTM Zone 10N\nEllipsoid = Clarke 1866\nDatum = NAD27 (CONUS)"
+
+ */
+
+@@ -259,6 +261,11 @@
+ OGRSpatialReference oSRS;
+
+ /* -------------------------------------------------------------------- */
++/* Make sure we have hooked CSVFilename(). */
++/* -------------------------------------------------------------------- */
++ LibgeotiffOneTimeInit();
++
++/* -------------------------------------------------------------------- */
+ /* Handle non-standard coordinate systems where GTModelTypeGeoKey */
+ /* is not defined, but ProjectedCSTypeGeoKey is defined (ticket #3019) */
+ /* -------------------------------------------------------------------- */
+@@ -338,9 +345,8 @@
+ GTIFKeyGet( hGTIF, GeogCitationGeoKey, szName,
+ 0, sizeof(szName) );
+
+-#if GDAL_VERSION_NUM >=1900
+ oSRS.SetGeocCS( szName );
+-#endif
++
+ char *pszUnitsName = NULL;
+
+ GTIFGetUOMLengthInfo( psDefn->UOMLength, &pszUnitsName, NULL );
+@@ -357,6 +363,87 @@
+ }
+
+ /* -------------------------------------------------------------------- */
++/* #3901: In libgeotiff 1.3.0 and earlier we incorrectly */
++/* interpreted linear projection parameter geokeys (false */
++/* easting/northing) as being in meters instead of the */
++/* coordinate system of the file. The following code attempts */
++/* to provide mechanisms for fixing the issue if we are linked */
++/* with an older version of libgeotiff. */
++/* -------------------------------------------------------------------- */
++ int iParm;
++ const char *pszLinearUnits =
++ CPLGetConfigOption( "GTIFF_LINEAR_UNITS", "DEFAULT" );
++
++#if LIBGEOTIFF_VERSION <= 1300
++ if( EQUAL(pszLinearUnits,"DEFAULT") && psDefn->Projection == KvUserDefined )
++ {
++ for( iParm = 0; iParm < psDefn->nParms; iParm++ )
++ {
++ switch( psDefn->ProjParmId[iParm] )
++ {
++ case ProjFalseEastingGeoKey:
++ case ProjFalseNorthingGeoKey:
++ case ProjFalseOriginEastingGeoKey:
++ case ProjFalseOriginNorthingGeoKey:
++ case ProjCenterEastingGeoKey:
++ case ProjCenterNorthingGeoKey:
++ if( psDefn->UOMLengthInMeters != 0
++ && psDefn->UOMLengthInMeters != 1.0 )
++ {
++ psDefn->ProjParm[iParm] *= psDefn->UOMLengthInMeters;
++ CPLDebug( "GTIFF", "converting geokey to meters to fix bug in old libgeotiff" );
++ }
++ break;
++
++ default:
++ break;
++ }
++ }
++ }
++#endif /* LIBGEOTIFF_VERSION <= 1300 */
++
++/* -------------------------------------------------------------------- */
++/* #3901: If folks have broken GeoTIFF files generated with */
++/* older versions of GDAL+libgeotiff, then they may need a */
++/* hack to allow them to be read properly. This is that */
++/* hack. We basically try to undue the conversion applied by */
++/* libgeotiff to meters (or above) to simulate the old */
++/* behavior. */
++/* -------------------------------------------------------------------- */
++ short bLinearUnitsMarkedCorrect = FALSE;
++
++ GTIFKeyGet(hGTIF, (geokey_t) ProjLinearUnitsInterpCorrectGeoKey,
++ &bLinearUnitsMarkedCorrect, 0, 1);
++
++ if( EQUAL(pszLinearUnits,"BROKEN")
++ && psDefn->Projection == KvUserDefined
++ && !bLinearUnitsMarkedCorrect )
++ {
++ for( iParm = 0; iParm < psDefn->nParms; iParm++ )
++ {
++ switch( psDefn->ProjParmId[iParm] )
++ {
++ case ProjFalseEastingGeoKey:
++ case ProjFalseNorthingGeoKey:
++ case ProjFalseOriginEastingGeoKey:
++ case ProjFalseOriginNorthingGeoKey:
++ case ProjCenterEastingGeoKey:
++ case ProjCenterNorthingGeoKey:
++ if( psDefn->UOMLengthInMeters != 0
++ && psDefn->UOMLengthInMeters != 1.0 )
++ {
++ psDefn->ProjParm[iParm] /= psDefn->UOMLengthInMeters;
++ CPLDebug( "GTIFF", "converting geokey to accomodate old broken file due to GTIFF_LINEAR_UNITS=BROKEN setting." );
++ }
++ break;
++
++ default:
++ break;
++ }
++ }
++ }
++
++/* -------------------------------------------------------------------- */
+ /* If this is a projected SRS we set the PROJCS keyword first */
+ /* to ensure that the GEOGCS will be a child. */
+ /* -------------------------------------------------------------------- */
+@@ -482,6 +569,7 @@
+ dfSemiMajor = psDefn->SemiMajor;
+ if( dfSemiMajor == 0.0 )
+ {
++ CPLFree(pszSpheroidName);
+ pszSpheroidName = CPLStrdup("unretrievable - using WGS84");
+ dfSemiMajor = SRS_WGS84_SEMIMAJOR;
+ dfInvFlattening = SRS_WGS84_INVFLATTENING;
+@@ -499,7 +587,7 @@
+ if(!pszGeogName || strlen(pszGeogName) == 0)
+ {
+ CPLFree(pszGeogName);
+- pszGeogName = CPLStrdup( pszDatumName );
++ pszGeogName = CPLStrdup( pszDatumName ? pszDatumName : "unknown" );
+ }
+
+ if(aUnitGot)
+@@ -613,7 +701,7 @@
+ break;
+
+ case CT_Stereographic:
+- oSRS.SetOS( adfParm[0], adfParm[1],
++ oSRS.SetStereographic( adfParm[0], adfParm[1],
+ adfParm[4],
+ adfParm[5], adfParm[6] );
+ break;
+@@ -625,6 +713,13 @@
+ adfParm[5], adfParm[6] );
+ break;
+
++ case CT_HotineObliqueMercatorAzimuthCenter:
++ oSRS.SetHOMAC( adfParm[0], adfParm[1],
++ adfParm[2], adfParm[3],
++ adfParm[4],
++ adfParm[5], adfParm[6] );
++ break;
++
+ case CT_EquidistantConic:
+ oSRS.SetEC( adfParm[0], adfParm[1],
+ adfParm[2], adfParm[3],
+@@ -788,6 +883,16 @@
+ }
+
+ /* -------------------------------------------------------------------- */
++/* This addresses another case where the EGM96 Vertical Datum code */
++/* is mis-used as a Vertical CS code (#4922) */
++/* -------------------------------------------------------------------- */
++ if( verticalCSType == 5171 )
++ {
++ verticalDatum = 5171;
++ verticalCSType = 5773;
++ }
++
++/* -------------------------------------------------------------------- */
+ /* Somewhat similarly, codes 5001 to 5033 were treated as */
+ /* vertical coordinate systems based on ellipsoidal heights. */
+ /* We use the corresponding 2d geodetic datum as the vertical */
+@@ -948,7 +1053,7 @@
+ dfFactorC = GTIFAtof(
+ CSVGetField( pszFilename,
+ "uom_code", szSearchKey, CC_Integer,
+- "factor_b" ));
++ "factor_c" ));
+ if( dfFactorB != 0.0 && dfFactorC != 0.0 )
+ sprintf( szInMeters, "%.16g", dfFactorB / dfFactorC );
+ else
+@@ -1147,7 +1252,11 @@
+ double dfLinearUOM = poSRS->GetLinearUnits( &pszLinearUOMName );
+ int nUOMLengthCode = 9001; /* meters */
+
+- if( (pszLinearUOMName != NULL
++ if( poSRS->GetAuthorityName("PROJCS|UNIT") != NULL
++ && EQUAL(poSRS->GetAuthorityName("PROJCS|UNIT"),"EPSG")
++ && poSRS->GetAttrNode( "PROJCS|UNIT" ) != poSRS->GetAttrNode("GEOGCS|UNIT") )
++ nUOMLengthCode = atoi(poSRS->GetAuthorityCode("PROJCS|UNIT"));
++ else if( (pszLinearUOMName != NULL
+ && EQUAL(pszLinearUOMName,SRS_UL_FOOT))
+ || fabs(dfLinearUOM-GTIFAtof(SRS_UL_FOOT_CONV)) < 0.0000001 )
+ nUOMLengthCode = 9002; /* international foot */
+@@ -1181,13 +1290,11 @@
+ ModelTypeProjected);
+ GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1, nPCS );
+ }
+-#if GDAL_VERSION_NUM >=1900
+ else if( poSRS->IsGeocentric() )
+ {
+ GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
+ ModelTypeGeocentric );
+ }
+-#endif
+ else if( pszProjection == NULL )
+ {
+ if( poSRS->IsGeographic() )
+@@ -1197,15 +1304,15 @@
+ }
+ else if( EQUAL(pszProjection,SRS_PT_ALBERS_CONIC_EQUAL_AREA) )
+ {
+- GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
+ ModelTypeProjected);
+- GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+- GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+
+- GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
+- CT_AlbersEqualArea );
++ GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
++ CT_AlbersEqualArea );
+
+ GTIFKeySet(psGTIF, ProjStdParallelGeoKey, TYPE_DOUBLE, 1,
+ poSRS->GetNormProjParm( SRS_PP_STANDARD_PARALLEL_1, 0.0 ) );
+@@ -1220,17 +1327,17 @@
+ poSRS->GetNormProjParm( SRS_PP_LONGITUDE_OF_CENTER, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseEastingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseNorthingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
+ }
+
+ else if( poSRS->GetUTMZone() != 0 )
+ {
+ int bNorth, nZone, nProjection;
+
+- GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
+ ModelTypeProjected);
+
+ nZone = poSRS->GetUTMZone( &bNorth );
+@@ -1275,15 +1382,15 @@
+
+ else if( EQUAL(pszProjection,SRS_PT_TRANSVERSE_MERCATOR) )
+ {
+- GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
+ ModelTypeProjected);
+- GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+- GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+
+- GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
+- CT_TransverseMercator );
++ GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
++ CT_TransverseMercator );
+
+ GTIFKeySet(psGTIF, ProjNatOriginLatGeoKey, TYPE_DOUBLE, 1,
+ poSRS->GetNormProjParm( SRS_PP_LATITUDE_OF_ORIGIN, 0.0 ) );
+@@ -1295,23 +1402,23 @@
+ poSRS->GetNormProjParm( SRS_PP_SCALE_FACTOR, 1.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseEastingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseNorthingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
+ }
+
+ else if( EQUAL(pszProjection,SRS_PT_TRANSVERSE_MERCATOR_SOUTH_ORIENTED) )
+ {
+- GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
+ ModelTypeProjected);
+- GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+- GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+
+- GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
+- CT_TransvMercator_SouthOriented );
++ GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
++ CT_TransvMercator_SouthOriented );
+
+ GTIFKeySet(psGTIF, ProjNatOriginLatGeoKey, TYPE_DOUBLE, 1,
+ poSRS->GetNormProjParm( SRS_PP_LATITUDE_OF_ORIGIN, 0.0 ) );
+@@ -1323,25 +1430,25 @@
+ poSRS->GetNormProjParm( SRS_PP_SCALE_FACTOR, 1.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseEastingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseNorthingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
+ }
+
+ else if( EQUAL(pszProjection,SRS_PT_MERCATOR_2SP)
+ || EQUAL(pszProjection,SRS_PT_MERCATOR_1SP) )
+
+ {
+- GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
+ ModelTypeProjected);
+- GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+- GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+
+- GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
+- CT_Mercator );
++ GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
++ CT_Mercator );
+
+ GTIFKeySet(psGTIF, ProjNatOriginLatGeoKey, TYPE_DOUBLE, 1,
+ poSRS->GetNormProjParm( SRS_PP_LATITUDE_OF_ORIGIN, 0.0 ) );
+@@ -1353,23 +1460,23 @@
+ poSRS->GetNormProjParm( SRS_PP_SCALE_FACTOR, 1.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseEastingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseNorthingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
+ }
+
+ else if( EQUAL(pszProjection,SRS_PT_OBLIQUE_STEREOGRAPHIC) )
+ {
+- GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
+ ModelTypeProjected);
+- GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+- GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+
+- GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
+- CT_ObliqueStereographic );
++ GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
++ CT_ObliqueStereographic );
+
+ GTIFKeySet(psGTIF, ProjNatOriginLatGeoKey, TYPE_DOUBLE, 1,
+ poSRS->GetNormProjParm( SRS_PP_LATITUDE_OF_ORIGIN, 0.0 ) );
+@@ -1381,23 +1488,23 @@
+ poSRS->GetNormProjParm( SRS_PP_SCALE_FACTOR, 1.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseEastingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseNorthingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
+ }
+
+ else if( EQUAL(pszProjection,SRS_PT_STEREOGRAPHIC) )
+ {
+- GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
+ ModelTypeProjected);
+- GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+- GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+
+- GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
+- CT_Stereographic );
++ GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
++ CT_Stereographic );
+
+ GTIFKeySet(psGTIF, ProjCenterLatGeoKey, TYPE_DOUBLE, 1,
+ poSRS->GetNormProjParm( SRS_PP_LATITUDE_OF_ORIGIN, 0.0 ) );
+@@ -1409,23 +1516,23 @@
+ poSRS->GetNormProjParm( SRS_PP_SCALE_FACTOR, 1.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseEastingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseNorthingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
+ }
+
+ else if( EQUAL(pszProjection,SRS_PT_POLAR_STEREOGRAPHIC) )
+ {
+- GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
+ ModelTypeProjected);
+- GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+- GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+
+- GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
+- CT_PolarStereographic );
++ GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
++ CT_PolarStereographic );
+
+ GTIFKeySet(psGTIF, ProjNatOriginLatGeoKey, TYPE_DOUBLE, 1,
+ poSRS->GetNormProjParm( SRS_PP_LATITUDE_OF_ORIGIN, 0.0 ) );
+@@ -1437,23 +1544,57 @@
+ poSRS->GetNormProjParm( SRS_PP_SCALE_FACTOR, 1.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseEastingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseNorthingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
+ }
+
+ else if( EQUAL(pszProjection,SRS_PT_HOTINE_OBLIQUE_MERCATOR) )
+ {
+- GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
++ ModelTypeProjected);
++ GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
++ KvUserDefined );
++ GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
++ KvUserDefined );
++
++ GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
++ CT_ObliqueMercator );
++
++ GTIFKeySet(psGTIF, ProjCenterLatGeoKey, TYPE_DOUBLE, 1,
++ poSRS->GetNormProjParm( SRS_PP_LATITUDE_OF_CENTER, 0.0 ) );
++
++ GTIFKeySet(psGTIF, ProjCenterLongGeoKey, TYPE_DOUBLE, 1,
++ poSRS->GetNormProjParm( SRS_PP_LONGITUDE_OF_CENTER, 0.0 ) );
++
++ GTIFKeySet(psGTIF, ProjAzimuthAngleGeoKey, TYPE_DOUBLE, 1,
++ poSRS->GetNormProjParm( SRS_PP_AZIMUTH, 0.0 ) );
++
++ GTIFKeySet(psGTIF, ProjRectifiedGridAngleGeoKey, TYPE_DOUBLE, 1,
++ poSRS->GetNormProjParm( SRS_PP_RECTIFIED_GRID_ANGLE, 0.0 ) );
++
++ GTIFKeySet(psGTIF, ProjScaleAtCenterGeoKey, TYPE_DOUBLE, 1,
++ poSRS->GetNormProjParm( SRS_PP_SCALE_FACTOR, 1.0 ) );
++
++ GTIFKeySet(psGTIF, ProjFalseEastingGeoKey, TYPE_DOUBLE, 1,
++ poSRS->GetProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
++
++ GTIFKeySet(psGTIF, ProjFalseNorthingGeoKey, TYPE_DOUBLE, 1,
++ poSRS->GetProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
++ }
++
++ else if( EQUAL(pszProjection,SRS_PT_HOTINE_OBLIQUE_MERCATOR_AZIMUTH_CENTER) )
++ {
++ GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
+ ModelTypeProjected);
+- GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+- GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+
+- GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
+- CT_ObliqueMercator );
++ GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
++ CT_HotineObliqueMercatorAzimuthCenter );
+
+ GTIFKeySet(psGTIF, ProjCenterLatGeoKey, TYPE_DOUBLE, 1,
+ poSRS->GetNormProjParm( SRS_PP_LATITUDE_OF_CENTER, 0.0 ) );
+@@ -1471,23 +1612,23 @@
+ poSRS->GetNormProjParm( SRS_PP_SCALE_FACTOR, 1.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseEastingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseNorthingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
+ }
+
+ else if( EQUAL(pszProjection,SRS_PT_CASSINI_SOLDNER) )
+ {
+- GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
+ ModelTypeProjected);
+- GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+- GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+
+- GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
+- CT_CassiniSoldner );
++ GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
++ CT_CassiniSoldner );
+
+ GTIFKeySet(psGTIF, ProjNatOriginLatGeoKey, TYPE_DOUBLE, 1,
+ poSRS->GetNormProjParm( SRS_PP_LATITUDE_OF_ORIGIN, 0.0 ) );
+@@ -1496,23 +1637,23 @@
+ poSRS->GetNormProjParm( SRS_PP_CENTRAL_MERIDIAN, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseEastingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseNorthingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
+ }
+
+ else if( EQUAL(pszProjection,SRS_PT_EQUIDISTANT_CONIC) )
+ {
+- GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
+ ModelTypeProjected);
+- GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+- GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+
+- GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
+- CT_EquidistantConic );
++ GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
++ CT_EquidistantConic );
+
+ GTIFKeySet(psGTIF, ProjStdParallel1GeoKey, TYPE_DOUBLE, 1,
+ poSRS->GetNormProjParm( SRS_PP_STANDARD_PARALLEL_1, 0.0 ) );
+@@ -1527,23 +1668,23 @@
+ poSRS->GetNormProjParm( SRS_PP_LONGITUDE_OF_CENTER, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseEastingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseNorthingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
+ }
+
+ else if( EQUAL(pszProjection,SRS_PT_POLYCONIC) )
+ {
+- GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
+ ModelTypeProjected);
+- GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+- GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+
+- GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
+- CT_Polyconic );
++ GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
++ CT_Polyconic );
+
+ GTIFKeySet(psGTIF, ProjNatOriginLatGeoKey, TYPE_DOUBLE, 1,
+ poSRS->GetNormProjParm( SRS_PP_LATITUDE_OF_ORIGIN, 0.0 ) );
+@@ -1555,23 +1696,23 @@
+ poSRS->GetNormProjParm( SRS_PP_SCALE_FACTOR, 1.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseEastingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseNorthingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
+ }
+
+ else if( EQUAL(pszProjection,SRS_PT_AZIMUTHAL_EQUIDISTANT) )
+ {
+- GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
+ ModelTypeProjected);
+- GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+- GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+
+- GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
+- CT_AzimuthalEquidistant );
++ GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
++ CT_AzimuthalEquidistant );
+
+ GTIFKeySet(psGTIF, ProjCenterLatGeoKey, TYPE_DOUBLE, 1,
+ poSRS->GetNormProjParm( SRS_PP_LATITUDE_OF_CENTER, 0.0 ) );
+@@ -1580,23 +1721,23 @@
+ poSRS->GetNormProjParm( SRS_PP_LONGITUDE_OF_CENTER, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseEastingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseNorthingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
+ }
+
+ else if( EQUAL(pszProjection,SRS_PT_MILLER_CYLINDRICAL) )
+ {
+- GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
+ ModelTypeProjected);
+- GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+- GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+
+- GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
+- CT_MillerCylindrical );
++ GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
++ CT_MillerCylindrical );
+
+ GTIFKeySet(psGTIF, ProjCenterLatGeoKey, TYPE_DOUBLE, 1,
+ poSRS->GetNormProjParm( SRS_PP_LATITUDE_OF_CENTER, 0.0 ) );
+@@ -1605,23 +1746,23 @@
+ poSRS->GetNormProjParm( SRS_PP_LONGITUDE_OF_CENTER, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseEastingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseNorthingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
+ }
+
+ else if( EQUAL(pszProjection,SRS_PT_EQUIRECTANGULAR) )
+ {
+- GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
+ ModelTypeProjected);
+- GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+- GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+
+- GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
+- CT_Equirectangular );
++ GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
++ CT_Equirectangular );
+
+ GTIFKeySet(psGTIF, ProjCenterLatGeoKey, TYPE_DOUBLE, 1,
+ poSRS->GetNormProjParm( SRS_PP_LATITUDE_OF_ORIGIN, 0.0 ) );
+@@ -1633,23 +1774,23 @@
+ poSRS->GetNormProjParm( SRS_PP_STANDARD_PARALLEL_1, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseEastingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseNorthingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
+ }
+
+ else if( EQUAL(pszProjection,SRS_PT_GNOMONIC) )
+ {
+- GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
+ ModelTypeProjected);
+- GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+- GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+
+- GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
+- CT_Gnomonic );
++ GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
++ CT_Gnomonic );
+
+ GTIFKeySet(psGTIF, ProjCenterLatGeoKey, TYPE_DOUBLE, 1,
+ poSRS->GetNormProjParm( SRS_PP_LATITUDE_OF_ORIGIN, 0.0 ) );
+@@ -1658,23 +1799,23 @@
+ poSRS->GetNormProjParm( SRS_PP_CENTRAL_MERIDIAN, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseEastingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseNorthingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
+ }
+
+ else if( EQUAL(pszProjection,SRS_PT_LAMBERT_AZIMUTHAL_EQUAL_AREA) )
+ {
+- GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
+ ModelTypeProjected);
+- GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+- GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+
+- GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
+- CT_LambertAzimEqualArea );
++ GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
++ CT_LambertAzimEqualArea );
+
+ GTIFKeySet(psGTIF, ProjCenterLatGeoKey, TYPE_DOUBLE, 1,
+ poSRS->GetNormProjParm( SRS_PP_LATITUDE_OF_CENTER, 0.0 ) );
+@@ -1683,23 +1824,23 @@
+ poSRS->GetNormProjParm( SRS_PP_LONGITUDE_OF_CENTER, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseEastingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseNorthingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
+ }
+
+ else if( EQUAL(pszProjection,SRS_PT_ORTHOGRAPHIC) )
+ {
+- GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
+ ModelTypeProjected);
+- GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+- GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+
+- GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
+- CT_Orthographic );
++ GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
++ CT_Orthographic );
+
+ GTIFKeySet(psGTIF, ProjCenterLatGeoKey, TYPE_DOUBLE, 1,
+ poSRS->GetNormProjParm( SRS_PP_LATITUDE_OF_ORIGIN, 0.0 ) );
+@@ -1708,23 +1849,23 @@
+ poSRS->GetNormProjParm( SRS_PP_CENTRAL_MERIDIAN, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseEastingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseNorthingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
+ }
+
+ else if( EQUAL(pszProjection,SRS_PT_NEW_ZEALAND_MAP_GRID) )
+ {
+- GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
+ ModelTypeProjected);
+- GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+- GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+
+- GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
+- CT_NewZealandMapGrid );
++ GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
++ CT_NewZealandMapGrid );
+
+ GTIFKeySet(psGTIF, ProjNatOriginLatGeoKey, TYPE_DOUBLE, 1,
+ poSRS->GetNormProjParm( SRS_PP_LATITUDE_OF_ORIGIN, 0.0 ) );
+@@ -1733,89 +1874,89 @@
+ poSRS->GetNormProjParm( SRS_PP_CENTRAL_MERIDIAN, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseEastingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseNorthingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
+ }
+
+ else if( EQUAL(pszProjection,SRS_PT_ROBINSON) )
+ {
+- GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
+ ModelTypeProjected);
+- GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+- GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+
+- GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
+- CT_Robinson );
++ GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
++ CT_Robinson );
+
+ GTIFKeySet(psGTIF, ProjCenterLongGeoKey, TYPE_DOUBLE, 1,
+ poSRS->GetNormProjParm( SRS_PP_LONGITUDE_OF_CENTER, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseEastingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseNorthingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
+ }
+
+ else if( EQUAL(pszProjection,SRS_PT_SINUSOIDAL) )
+ {
+- GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
+ ModelTypeProjected);
+- GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+- GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+
+- GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
+- CT_Sinusoidal );
++ GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
++ CT_Sinusoidal );
+
+ GTIFKeySet(psGTIF, ProjCenterLongGeoKey, TYPE_DOUBLE, 1,
+ poSRS->GetNormProjParm( SRS_PP_LONGITUDE_OF_CENTER, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseEastingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseNorthingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
+ }
+
+ else if( EQUAL(pszProjection,SRS_PT_VANDERGRINTEN) )
+ {
+- GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
+ ModelTypeProjected);
+- GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+- GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+
+- GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
+- CT_VanDerGrinten );
++ GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
++ CT_VanDerGrinten );
+
+ GTIFKeySet(psGTIF, ProjCenterLongGeoKey, TYPE_DOUBLE, 1,
+ poSRS->GetNormProjParm( SRS_PP_CENTRAL_MERIDIAN, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseEastingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseNorthingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
+ }
+
+ else if( EQUAL(pszProjection,SRS_PT_ALBERS_CONIC_EQUAL_AREA) )
+ {
+- GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
+ ModelTypeProjected);
+- GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+- GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+
+- GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
+- CT_AlbersEqualArea );
++ GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
++ CT_AlbersEqualArea );
+
+ GTIFKeySet(psGTIF, ProjNatOriginLatGeoKey, TYPE_DOUBLE, 1,
+ poSRS->GetNormProjParm( SRS_PP_LATITUDE_OF_CENTER, 0.0 ) );
+@@ -1830,23 +1971,23 @@
+ poSRS->GetNormProjParm( SRS_PP_STANDARD_PARALLEL_2, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseEastingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseNorthingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
+ }
+
+ else if( EQUAL(pszProjection,SRS_PT_LAMBERT_CONFORMAL_CONIC_2SP) )
+ {
+- GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
+ ModelTypeProjected);
+- GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+- GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+
+- GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
+- CT_LambertConfConic_2SP );
++ GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
++ CT_LambertConfConic_2SP );
+
+ GTIFKeySet(psGTIF, ProjFalseOriginLatGeoKey, TYPE_DOUBLE, 1,
+ poSRS->GetNormProjParm( SRS_PP_LATITUDE_OF_ORIGIN, 0.0 ) );
+@@ -1861,23 +2002,23 @@
+ poSRS->GetNormProjParm( SRS_PP_STANDARD_PARALLEL_2, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseOriginEastingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseOriginNorthingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
+ }
+
+ else if( EQUAL(pszProjection,SRS_PT_LAMBERT_CONFORMAL_CONIC_1SP) )
+ {
+- GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
+ ModelTypeProjected);
+- GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+- GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+
+- GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
+- CT_LambertConfConic_1SP );
++ GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
++ CT_LambertConfConic_1SP );
+
+ GTIFKeySet(psGTIF, ProjNatOriginLatGeoKey, TYPE_DOUBLE, 1,
+ poSRS->GetNormProjParm( SRS_PP_LATITUDE_OF_ORIGIN, 0.0 ) );
+@@ -1889,23 +2030,23 @@
+ poSRS->GetNormProjParm( SRS_PP_SCALE_FACTOR, 1.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseEastingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseNorthingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
+ }
+
+ else if( EQUAL(pszProjection,SRS_PT_CYLINDRICAL_EQUAL_AREA) )
+ {
+- GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, GTModelTypeGeoKey, TYPE_SHORT, 1,
+ ModelTypeProjected);
+- GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectedCSTypeGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+- GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
++ GTIFKeySet(psGTIF, ProjectionGeoKey, TYPE_SHORT, 1,
+ KvUserDefined );
+
+- GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
+- CT_CylindricalEqualArea );
++ GTIFKeySet(psGTIF, ProjCoordTransGeoKey, TYPE_SHORT, 1,
++ CT_CylindricalEqualArea );
+
+ GTIFKeySet(psGTIF, ProjNatOriginLongGeoKey, TYPE_DOUBLE, 1,
+ poSRS->GetNormProjParm( SRS_PP_CENTRAL_MERIDIAN, 0.0 ) );
+@@ -1914,10 +2055,10 @@
+ poSRS->GetNormProjParm( SRS_PP_STANDARD_PARALLEL_1, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseEastingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_EASTING, 0.0 ) );
+
+ GTIFKeySet(psGTIF, ProjFalseNorthingGeoKey, TYPE_DOUBLE, 1,
+- poSRS->GetNormProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
++ poSRS->GetProjParm( SRS_PP_FALSE_NORTHING, 0.0 ) );
+ }
+
+ else
+@@ -1927,7 +2068,11 @@
+
+ // Note that VERTCS is an ESRI "spelling" of VERT_CS so we assume if
+ // we find it that we should try to treat this as a PE string.
+- if( bWritePEString || poSRS->GetAttrValue("VERTCS") != NULL )
++ bWritePEString |= (poSRS->GetAttrValue("VERTCS") != NULL);
++
++ if( bWritePEString
++ && CSLTestBoolean( CPLGetConfigOption("GTIFF_ESRI_CITATION",
++ "YES") ) )
+ {
+ /* Anyhing we can't map, we store as an ESRI PE string with a citation key */
+ char *pszPEString = NULL;
+@@ -1950,10 +2095,26 @@
+ }
+
+ /* -------------------------------------------------------------------- */
++/* Is there a false easting/northing set? If so, write out a */
++/* special geokey tag to indicate that GDAL has written these */
++/* with the proper interpretation of the linear units. */
++/* -------------------------------------------------------------------- */
++ double dfFE = 0.0, dfFN = 0.0;
++
++ if( (GTIFKeyGet(psGTIF, ProjFalseEastingGeoKey, &dfFE, 0, 1)
++ || GTIFKeyGet(psGTIF, ProjFalseNorthingGeoKey, &dfFN, 0, 1)
++ || GTIFKeyGet(psGTIF, ProjFalseOriginEastingGeoKey, &dfFE, 0, 1)
++ || GTIFKeyGet(psGTIF, ProjFalseOriginNorthingGeoKey, &dfFN, 0, 1))
++ && (dfFE != 0.0 || dfFN != 0.0)
++ && nUOMLengthCode != 9001 )
++ {
++ GTIFKeySet(psGTIF, (geokey_t) ProjLinearUnitsInterpCorrectGeoKey,
++ TYPE_SHORT, 1, (short) 1 );
++ }
++
++/* -------------------------------------------------------------------- */
+ /* Write linear units information. */
+ /* -------------------------------------------------------------------- */
+-#if GDAL_VERSION_NUM >=1900
+-
+ if( poSRS->IsGeocentric() )
+ {
+ GTIFKeySet(psGTIF, GeogLinearUnitsGeoKey, TYPE_SHORT, 1,
+@@ -1962,9 +2123,7 @@
+ GTIFKeySet( psGTIF, GeogLinearUnitSizeGeoKey, TYPE_DOUBLE, 1,
+ dfLinearUOM);
+ }
+- else
+-#endif
+- if( !poSRS->IsGeographic() )
++ else if( !poSRS->IsGeographic() )
+ {
+ GTIFKeySet(psGTIF, ProjLinearUnitsGeoKey, TYPE_SHORT, 1,
+ nUOMLengthCode );
+@@ -1973,8 +2132,15 @@
+ dfLinearUOM);
+
+ /* if linear units name is available and user defined, store it as citation */
+- if(!peStrStored && nUOMLengthCode == KvUserDefined && pszLinearUOMName && strlen(pszLinearUOMName)>0)
++ if(!peStrStored
++ && nUOMLengthCode == KvUserDefined
++ && pszLinearUOMName
++ && strlen(pszLinearUOMName)>0
++ && CSLTestBoolean( CPLGetConfigOption("GTIFF_ESRI_CITATION",
++ "YES") ) )
++ {
+ SetLinearUnitCitation(psGTIF, pszLinearUOMName);
++ }
+ }
+
+ /* -------------------------------------------------------------------- */
+@@ -2001,12 +2167,7 @@
+ /* -------------------------------------------------------------------- */
+ if( poSRS->GetRoot() != NULL
+ && poSRS->GetRoot()->GetChild(0) != NULL
+- && (poSRS->IsProjected() || poSRS->IsLocal()
+-
+-#if GDAL_VERSION_NUM >=1900
+- || poSRS->IsGeocentric()
+-#endif
+- ) )
++ && (poSRS->IsProjected() || poSRS->IsLocal() || poSRS->IsGeocentric()) )
+ {
+ GTIFKeySet( psGTIF, GTCitationGeoKey, TYPE_ASCII, 0,
+ poSRS->GetRoot()->GetChild(0)->GetValue() );
+@@ -2097,7 +2258,9 @@
+ GTIFKeySet( psGTIF, GeogSemiMajorAxisGeoKey, TYPE_DOUBLE, 1,
+ dfSemiMajor );
+
+- if( nGCS == KvUserDefined )
++ if( nGCS == KvUserDefined
++ && CSLTestBoolean( CPLGetConfigOption("GTIFF_ESRI_CITATION",
++ "YES") ) )
+ SetGeogCSCitation(psGTIF, poSRS, angUnitName, nDatum, nSpheroid);
+ }
+
+@@ -2105,15 +2268,23 @@
+ /* Do we have TOWGS84 parameters? */
+ /* -------------------------------------------------------------------- */
+
+-#if LIBGEOTIFF_VERSION >= 1310
++#if LIBGEOTIFF_VERSION >= 1310 && !defined(GEO_NORMALIZE_DISABLE_TOWGS84)
+ double adfTOWGS84[7];
+
+ if( poSRS->GetTOWGS84( adfTOWGS84 ) == OGRERR_NONE )
+ {
+ if( adfTOWGS84[3] == 0.0 && adfTOWGS84[4] == 0.0
+ && adfTOWGS84[5] == 0.0 && adfTOWGS84[6] == 0.0 )
+- GTIFKeySet( psGTIF, GeogTOWGS84GeoKey, TYPE_DOUBLE, 3,
+- adfTOWGS84 );
++ {
++ if( nGCS == GCS_WGS_84 && adfTOWGS84[0] == 0.0
++ && adfTOWGS84[1] == 0.0 && adfTOWGS84[2] == 0.0 )
++ {
++ ; /* do nothing */
++ }
++ else
++ GTIFKeySet( psGTIF, GeogTOWGS84GeoKey, TYPE_DOUBLE, 3,
++ adfTOWGS84 );
++ }
+ else
+ GTIFKeySet( psGTIF, GeogTOWGS84GeoKey, TYPE_DOUBLE, 7,
+ adfTOWGS84 );
+@@ -2160,49 +2331,93 @@
+ CPLErr GTIFWktFromMemBuf( int nSize, unsigned char *pabyBuffer,
+ char **ppszWKT, double *padfGeoTransform,
+ int *pnGCPCount, GDAL_GCP **ppasGCPList )
++{
++ return GTIFWktFromMemBufEx(nSize, pabyBuffer, ppszWKT, padfGeoTransform,
++ pnGCPCount, ppasGCPList, NULL);
++}
++
++CPLErr GTIFWktFromMemBufEx( int nSize, unsigned char *pabyBuffer,
++ char **ppszWKT, double *padfGeoTransform,
++ int *pnGCPCount, GDAL_GCP **ppasGCPList,
++ int *pbPixelIsPoint )
+
+ {
+- TIFF *hTIFF;
+- GTIF *hGTIF;
+- GTIFDefn sGTIFDefn;
+- char szFilename[100];
++ bool bPixelIsPoint = false;
++ int bPointGeoIgnore = FALSE;
++ short nRasterType;
++ char szFilename[100];
+
+- sprintf( szFilename, "/vsimem/wkt_from_mem_buf_%ld.tif",
++ sprintf( szFilename, "/vsimem/wkt_from_mem_buf_%ld.tif",
+ (long) CPLGetPID() );
+
+ /* -------------------------------------------------------------------- */
++/* Make sure we have hooked CSVFilename(). */
++/* -------------------------------------------------------------------- */
++ LibgeotiffOneTimeInit();
++
++/* -------------------------------------------------------------------- */
+ /* Create a memory file from the buffer. */
+ /* -------------------------------------------------------------------- */
+ VSILFILE *fp = VSIFileFromMemBuffer( szFilename, pabyBuffer, nSize, FALSE );
+ if( fp == NULL )
+ return CE_Failure;
+- VSIFCloseL( fp );
+
+ /* -------------------------------------------------------------------- */
+ /* Initialize access to the memory geotiff structure. */
+ /* -------------------------------------------------------------------- */
+- hTIFF = VSI_TIFFOpen( szFilename, "r" );
++ TIFF *hTIFF;
++
++ hTIFF = VSI_TIFFOpen( szFilename, "rc", fp );
+
+ if( hTIFF == NULL )
+ {
+ CPLError( CE_Failure, CPLE_AppDefined,
+ "TIFF/GeoTIFF structure is corrupt." );
+ VSIUnlink( szFilename );
++ VSIFCloseL( fp );
+ return CE_Failure;
+ }
+
+ /* -------------------------------------------------------------------- */
+ /* Get the projection definition. */
+ /* -------------------------------------------------------------------- */
++ GTIF *hGTIF;
++ GTIFDefn *psGTIFDefn;
++
+ hGTIF = GTIFNew(hTIFF);
+
+- if( hGTIF != NULL && GTIFGetDefn( hGTIF, &sGTIFDefn ) )
+- *ppszWKT = GTIFGetOGISDefn( hGTIF, &sGTIFDefn );
++ if( hGTIF != NULL && GTIFKeyGet(hGTIF, GTRasterTypeGeoKey, &nRasterType,
++ 0, 1 ) == 1
++ && nRasterType == (short) RasterPixelIsPoint )
++ {
++ bPixelIsPoint = true;
++ bPointGeoIgnore =
++ CSLTestBoolean( CPLGetConfigOption("GTIFF_POINT_GEO_IGNORE",
++ "FALSE") );
++ }
++ if( pbPixelIsPoint )
++ *pbPixelIsPoint = bPixelIsPoint;
++
++#if LIBGEOTIFF_VERSION >= 1410
++ psGTIFDefn = GTIFAllocDefn();
++#else
++ psGTIFDefn = (GTIFDefn *) CPLCalloc(1,sizeof(GTIFDefn));
++#endif
++
++
++ if( hGTIF != NULL && GTIFGetDefn( hGTIF, psGTIFDefn ) )
++ *ppszWKT = GTIFGetOGISDefn( hGTIF, psGTIFDefn );
+ else
+ *ppszWKT = NULL;
+
+ if( hGTIF )
+ GTIFFree( hGTIF );
++
++#if LIBGEOTIFF_VERSION >= 1410
++ GTIFFreeDefn(psGTIFDefn);
++#else
++ CPLFree(psGTIFDefn);
++#endif
+
+ /* -------------------------------------------------------------------- */
+ /* Get geotransform or tiepoints. */
+@@ -2233,6 +2448,13 @@
+ padfTiePoints[3] - padfTiePoints[0] * padfGeoTransform[1];
+ padfGeoTransform[3] =
+ padfTiePoints[4] - padfTiePoints[1] * padfGeoTransform[5];
++
++ // adjust for pixel is point in transform
++ if( bPixelIsPoint && !bPointGeoIgnore )
++ {
++ padfGeoTransform[0] -= (padfGeoTransform[1] * 0.5 + padfGeoTransform[2] * 0.5);
++ padfGeoTransform[3] -= (padfGeoTransform[4] * 0.5 + padfGeoTransform[5] * 0.5);
++ }
+ }
+ }
+
+@@ -2273,6 +2495,7 @@
+ /* Cleanup. */
+ /* -------------------------------------------------------------------- */
+ XTIFFClose( hTIFF );
++ VSIFCloseL( fp );
+
+ VSIUnlink( szFilename );
+
+@@ -2289,6 +2512,16 @@
+ CPLErr GTIFMemBufFromWkt( const char *pszWKT, const double *padfGeoTransform,
+ int nGCPCount, const GDAL_GCP *pasGCPList,
+ int *pnSize, unsigned char **ppabyBuffer )
++{
++ return GTIFMemBufFromWktEx(pszWKT, padfGeoTransform,
++ nGCPCount,pasGCPList,
++ pnSize, ppabyBuffer, FALSE);
++}
++
++CPLErr GTIFMemBufFromWktEx( const char *pszWKT, const double *padfGeoTransform,
++ int nGCPCount, const GDAL_GCP *pasGCPList,
++ int *pnSize, unsigned char **ppabyBuffer,
++ int bPixelIsPoint )
+
+ {
+ TIFF *hTIFF;
+@@ -2299,14 +2532,24 @@
+ (long) CPLGetPID() );
+
+ /* -------------------------------------------------------------------- */
++/* Make sure we have hooked CSVFilename(). */
++/* -------------------------------------------------------------------- */
++ LibgeotiffOneTimeInit();
++
++/* -------------------------------------------------------------------- */
+ /* Initialize access to the memory geotiff structure. */
+ /* -------------------------------------------------------------------- */
+- hTIFF = VSI_TIFFOpen( szFilename, "w" );
++ VSILFILE* fpL = VSIFOpenL( szFilename, "w" );
++ if( fpL == NULL )
++ return CE_Failure;
++
++ hTIFF = VSI_TIFFOpen( szFilename, "w", fpL );
+
+ if( hTIFF == NULL )
+ {
+ CPLError( CE_Failure, CPLE_AppDefined,
+ "TIFF/GeoTIFF structure is corrupt." );
++ VSIFCloseL(fpL);
+ return CE_Failure;
+ }
+
+@@ -2325,10 +2568,26 @@
+ /* Get the projection definition. */
+ /* -------------------------------------------------------------------- */
+
+- if( pszWKT != NULL )
++ int bPointGeoIgnore = FALSE;
++ if( bPixelIsPoint )
++ {
++ bPointGeoIgnore =
++ CSLTestBoolean( CPLGetConfigOption("GTIFF_POINT_GEO_IGNORE",
++ "FALSE") );
++ }
++
++ if( pszWKT != NULL || bPixelIsPoint )
+ {
+ hGTIF = GTIFNew(hTIFF);
+- GTIFSetFromOGISDefn( hGTIF, pszWKT );
++ if( pszWKT != NULL )
++ GTIFSetFromOGISDefn( hGTIF, pszWKT );
++
++ if( bPixelIsPoint )
++ {
++ GTIFKeySet(hGTIF, GTRasterTypeGeoKey, TYPE_SHORT, 1,
++ RasterPixelIsPoint);
++ }
++
+ GTIFWriteKeys( hGTIF );
+ GTIFFree( hGTIF );
+ }
+@@ -2336,6 +2595,7 @@
+ /* -------------------------------------------------------------------- */
+ /* Set the geotransform, or GCPs. */
+ /* -------------------------------------------------------------------- */
++
+ if( padfGeoTransform[0] != 0.0 || padfGeoTransform[1] != 1.0
+ || padfGeoTransform[2] != 0.0 || padfGeoTransform[3] != 0.0
+ || padfGeoTransform[4] != 0.0 || ABS(padfGeoTransform[5]) != 1.0 )
+@@ -2357,7 +2617,13 @@
+ adfTiePoints[3] = padfGeoTransform[0];
+ adfTiePoints[4] = padfGeoTransform[3];
+ adfTiePoints[5] = 0.0;
+-
++
++ if( bPixelIsPoint && !bPointGeoIgnore )
++ {
++ adfTiePoints[3] += padfGeoTransform[1] * 0.5 + padfGeoTransform[2] * 0.5;
++ adfTiePoints[4] += padfGeoTransform[4] * 0.5 + padfGeoTransform[5] * 0.5;
++ }
++
+ TIFFSetField( hTIFF, TIFFTAG_GEOTIEPOINTS, 6, adfTiePoints );
+ }
+ else
+@@ -2374,6 +2640,12 @@
+ adfMatrix[7] = padfGeoTransform[3];
+ adfMatrix[15] = 1.0;
+
++ if( bPixelIsPoint && !bPointGeoIgnore )
++ {
++ adfMatrix[3] += padfGeoTransform[1] * 0.5 + padfGeoTransform[2] * 0.5;
++ adfMatrix[7] += padfGeoTransform[4] * 0.5 + padfGeoTransform[5] * 0.5;
++ }
++
+ TIFFSetField( hTIFF, TIFFTAG_GEOTRANSMATRIX, 16, adfMatrix );
+ }
+ }
+@@ -2412,6 +2684,7 @@
+ TIFFWriteDirectory( hTIFF );
+
+ XTIFFClose( hTIFF );
++ VSIFCloseL(fpL);
+
+ /* -------------------------------------------------------------------- */
+ /* Read back from the memory buffer. It would be preferrable */
+@@ -2425,4 +2698,3 @@
+
+ return CE_None;
+ }
+-
+--- liblas.orig/src/gt_wkt_srs.h
++++ liblas/src/gt_wkt_srs.h
+@@ -1,5 +1,5 @@
+ /******************************************************************************
+- * $Id: gt_wkt_srs.h 21595 2011-01-28 04:21:40Z warmerdam $
++ * $Id$
+ *
+ * Project: GeoTIFF Driver
+ * Purpose: Implements translation between GeoTIFF normalized projection
+@@ -9,7 +9,7 @@
+ * Author: Even Rouault
+ *
+ ******************************************************************************
+- * Copyright (c) 2010, Even Rouault
++ * Copyright (c) 2010, Even Rouault <even dot rouault at mines-paris dot org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+--- liblas.orig/src/gt_wkt_srs_for_gdal.h
++++ liblas/src/gt_wkt_srs_for_gdal.h
+@@ -1,12 +1,12 @@
+ /******************************************************************************
+- * $Id: gt_wkt_srs_for_gdal.h 21595 2011-01-28 04:21:40Z warmerdam $
++ * $Id$
+ *
+ * Project: GeoTIFF Driver
+ * Purpose: Read/Write in-memory GeoTIFF file
+ * Author: Even Rouault
+ *
+ ******************************************************************************
+- * Copyright (c) 2010, Even Rouault
++ * Copyright (c) 2010-2012, Even Rouault <even dot rouault at mines-paris dot org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+@@ -39,10 +39,22 @@
+ const double *padfGeoTransform,
+ int nGCPCount, const GDAL_GCP *pasGCPList,
+ int *pnSize, unsigned char **ppabyBuffer );
++
++CPLErr GTIFMemBufFromWktEx( const char *pszWKT,
++ const double *padfGeoTransform,
++ int nGCPCount, const GDAL_GCP *pasGCPList,
++ int *pnSize, unsigned char **ppabyBuffer,
++ int bPixelIsPoint );
++
+ CPLErr CPL_DLL GTIFWktFromMemBuf( int nSize, unsigned char *pabyBuffer,
+ char **ppszWKT, double *padfGeoTransform,
+ int *pnGCPCount, GDAL_GCP **ppasGCPList );
+
+-CPL_C_END
++CPLErr GTIFWktFromMemBufEx( int nSize, unsigned char *pabyBuffer,
++ char **ppszWKT, double *padfGeoTransform,
++ int *pnGCPCount, GDAL_GCP **ppasGCPList,
++ int *pbPixelIsPoint );
++
++CPL_C_END;
+
+ #endif // GT_WKT_SRS_FOR_GDAL_H_INCLUDED
+--- liblas.orig/src/tifvsi.cpp
++++ liblas/src/tifvsi.cpp
+@@ -1,5 +1,5 @@
+ /******************************************************************************
+- * $Id: tifvsi.cpp 10645 2007-01-18 02:22:39Z warmerdam $
++ * $Id$
+ *
+ * Project: GeoTIFF Driver
+ * Purpose: Implement system hook functions for libtiff on top of CPL/VSI,
+@@ -9,6 +9,7 @@
+ *
+ ******************************************************************************
+ * Copyright (c) 2005, Frank Warmerdam, warmerdam at pobox.com
++ * Copyright (c) 2010-2012, Even Rouault <even dot rouault at mines-paris dot org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+@@ -32,12 +33,18 @@
+ /*
+ * TIFF Library UNIX-specific Routines.
+ */
+-#include "tiffio.h"
+ #include "cpl_vsi.h"
++#include "tifvsi.h"
++
++#include <errno.h>
+
+ // We avoid including xtiffio.h since it drags in the libgeotiff version
+ // of the VSI functions.
+
++#ifdef RENAME_INTERNAL_LIBGEOTIFF_SYMBOLS
++#include "gdal_libgeotiff_symbol_rename.h"
++#endif
++
+ CPL_C_START
+ extern TIFF CPL_DLL * XTIFFClientOpen(const char* name, const char* mode,
+ thandle_t thehandle,
+@@ -50,28 +57,36 @@
+ static tsize_t
+ _tiffReadProc(thandle_t fd, tdata_t buf, tsize_t size)
+ {
+- return VSIFReadL( buf, 1, size, (FILE *) fd );
++ return VSIFReadL( buf, 1, size, (VSILFILE *) fd );
+ }
+
+ static tsize_t
+ _tiffWriteProc(thandle_t fd, tdata_t buf, tsize_t size)
+ {
+- return VSIFWriteL( buf, 1, size, (FILE *) fd );
++ tsize_t nRet = VSIFWriteL( buf, 1, size, (VSILFILE *) fd );
++ if (nRet < size)
++ {
++ TIFFErrorExt( fd, "_tiffWriteProc", "%s", VSIStrerror( errno ) );
++ }
++ return nRet;
+ }
+
+ static toff_t
+ _tiffSeekProc(thandle_t fd, toff_t off, int whence)
+ {
+- if( VSIFSeekL( (FILE *) fd, off, whence ) == 0 )
+- return (toff_t) VSIFTellL( (FILE *) fd );
++ if( VSIFSeekL( (VSILFILE *) fd, off, whence ) == 0 )
++ return (toff_t) VSIFTellL( (VSILFILE *) fd );
+ else
++ {
++ TIFFErrorExt( fd, "_tiffSeekProc", "%s", VSIStrerror( errno ) );
+ return (toff_t) -1;
++ }
+ }
+
+ static int
+ _tiffCloseProc(thandle_t fd)
+ {
+- return VSIFCloseL( (FILE *) fd );
++ return 0;
+ }
+
+ static toff_t
+@@ -80,11 +95,11 @@
+ vsi_l_offset old_off;
+ toff_t file_size;
+
+- old_off = VSIFTellL( (FILE *) fd );
+- VSIFSeekL( (FILE *) fd, 0, SEEK_END );
++ old_off = VSIFTellL( (VSILFILE *) fd );
++ VSIFSeekL( (VSILFILE *) fd, 0, SEEK_END );
+
+- file_size = (toff_t) VSIFTellL( (FILE *) fd );
+- VSIFSeekL( (FILE *) fd, old_off, SEEK_SET );
++ file_size = (toff_t) VSIFTellL( (VSILFILE *) fd );
++ VSIFSeekL( (VSILFILE *) fd, old_off, SEEK_SET );
+
+ return file_size;
+ }
+@@ -105,12 +120,11 @@
+ /*
+ * Open a TIFF file for read/writing.
+ */
+-TIFF* VSI_TIFFOpen(const char* name, const char* mode)
++TIFF* VSI_TIFFOpen(const char* name, const char* mode,
++ VSILFILE* fp)
+ {
+- static const char module[] = "TIFFOpen";
+ int i, a_out;
+ char access[32];
+- FILE *fp;
+ TIFF *tif;
+
+ a_out = 0;
+@@ -128,24 +142,13 @@
+ }
+
+ strcat( access, "b" );
+-
+- fp = VSIFOpenL( name, access );
+- if (fp == NULL) {
+- if( errno >= 0 )
+- TIFFError(module,"%s: %s", name, VSIStrerror( errno ) );
+- else
+- TIFFError(module, "%s: Cannot open", name);
+- return ((TIFF *)0);
+- }
+
++ VSIFSeekL(fp, 0, SEEK_SET);
+ tif = XTIFFClientOpen(name, mode,
+ (thandle_t) fp,
+ _tiffReadProc, _tiffWriteProc,
+ _tiffSeekProc, _tiffCloseProc, _tiffSizeProc,
+ _tiffMapProc, _tiffUnmapProc);
+
+- if( tif == NULL )
+- VSIFCloseL( fp );
+-
+ return tif;
+ }
+--- liblas.orig/src/tifvsi.h
++++ liblas/src/tifvsi.h
+@@ -1,5 +1,5 @@
+ /******************************************************************************
+- * $Id: tifvsi.h 21102 2010-11-08 20:47:38Z rouault $
++ * $Id$
+ *
+ * Project: GeoTIFF Driver
+ * Purpose: Implement system hook functions for libtiff on top of CPL/VSI,
+@@ -9,6 +9,7 @@
+ *
+ ******************************************************************************
+ * Copyright (c) 2005, Frank Warmerdam, warmerdam at pobox.com
++ * Copyright (c) 2010, Even Rouault <even dot rouault at mines-paris dot org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+@@ -34,6 +35,6 @@
+
+ #include "tiffio.h"
+
+-TIFF* VSI_TIFFOpen(const char* name, const char* mode);
++TIFF* VSI_TIFFOpen(const char* name, const char* mode, VSILFILE* fp);
+
+ #endif // TIFVSI_H_INCLUDED
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/liblas.git
More information about the Pkg-grass-devel
mailing list