[gdal-dev] GDAL C# bindings and TIFF read projection trouble

Frank Warmerdam warmerdam at pobox.com
Tue Apr 1 11:16:22 EDT 2008


Kerry Halligan wrote:
> Can anyone help me out with problems reading the correct projection
> information from a TIFF image?
> 
> I am using GDAL C# bindings from FWTools (1.3.9) and am getting unexpected
> results for projection information of TIFF files.  If I use the gdalinfo
> utility I get the correct information, but if I use the gdal_csharp bindings
> I get "unnamed" as the projection.  This is causing difficulty when
> comparing projections before processing multiple files.  I am assuming this
> is a data and/or operator error, rather than a bug, but can anyone tell me
> what I might be doing wrong?  I also tried this with the most recent version
> of FWTools and received the same results.
> 
...
> *csharp code:
> 
> Gdal.AllRegister();
> Dataset ds = Gdal.Open(infile, Access.GA_ReadOnly);
> // get the projection
> string proj = ds.GetProjection();
> 
> printing 'proj' produces:
> *
> "PROJCS[\"unnamed\",GEOGCS[\"NAD83\",DATUM[\"North_American_Datum_1983\",SPHEROID[\"GRS
> 1980\",6378137,298.2572221010002
> ,AUTHORITY[\"EPSG\",\"7019\"]],AUTHORITY[\"EPSG\",\"6269\"]],PRIMEM[\"Greenwich\",0],UNIT[\"degree\",
> 0.0174532925199433],AUTHORITY[\"EPSG\",\"4269\"]],UNIT[\"US survey foot\",
> 0.3048006096012192
> ,AUTHORITY[\"EPSG\",\"9003\"]],AUTHORITY[\"EPSG\",\"26954\"]]"

Kerry,

I imagine this is due to either the GDAL_DATA or perhaps the GEOTIFF_CSV
environment variable not pointing to the proper .csv files.  The GeoTIFF
driver uses these to expand some coordinate systems in GeoTIFF defined
based on only an EPSG code.  For some such common coordinate systems
there is logic to expand them without the .csv files but some info
(such as the projection name) may be lost.  I presume this is what is
happening to you.

Note the FWTools Shell takes some effort to setup the environment
carefully.

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    | President OSGeo, http://osgeo.org



More information about the gdal-dev mailing list