[Gdal-dev] Small fix for geo_normalize.c in libgeotiff

Frank Warmerdam warmerdam at pobox.com
Mon Jun 7 09:00:47 EDT 2004


Roger James wrote:
> In recent builds the name of the datum.csv has changed to 
> gdal_datum.csv. This change has not been picked up in geo_nomalize.c.
> 
>  
> 
> int GTIFGetDatumInfo( int nDatumCode, char ** ppszName, short * 
> pnEllipsoid )
> 
>  
> 
> {
> 
>     char    szSearchKey[24];
> 
>     int           nEllipsoid;
> 
>     const char *pszFilename = CSVFilename( "datum.csv" );

Roger,

I have changed the code to read:

{
     char	szSearchKey[24];
     int		nEllipsoid;
     const char *pszFilename = CSVFilename( "datum.csv" );
     FILE       *fp;

/* -------------------------------------------------------------------- */
/*      If we can't find datum.csv then gdal_datum.csv is an            */
/*      acceptable fallback.  Mostly this is for GDAL.                  */
/* -------------------------------------------------------------------- */
     if( (fp = VSIFOpen(pszFilename,"r")) == NULL )
         pszFilename = CSVFilename( "gdal_datum.csv" );
     else
         VSIFClose( fp );


As might be deduced from the name, gdal_datum.csv is really GDAL specific.
It is the same as datum.csv with an extra column containing the equivelent
ESRI name for the datum.  I don't normally notice this problem because I have
the geotiff support files installed in /usr/local/share/epsg_csv.   However, in
a pure GDAL build using the internal libgeotiff this would be missing.

A more proper solution would likely be to have GDAL override the CSVFilename()
to apply this naming logic but that can be problematic in some situations
so I will take advantage of my role as maintainer of libgeotiff to hack in
GDAL specific support.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent




More information about the Gdal-dev mailing list