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

Kerry Halligan halligan.kerry at gmail.com
Tue Apr 1 13:27:25 EDT 2008


Tamas and Frank,

Thank you both for your replies.  I tried Tamas' suggestion and found the
same problem.  I suspect that my problem is that it is not finding the
correct CSV files as Frank suggested.  Because I am using the prebuilt
binaries from FWTools, I have been copying the DLL files (e.g., gdal_csharp)
into my c# application directories (debug/release) but linking to support
files by simply including the appropriate directories (in my case:
C:\Program Files\FWTools1.3.9\bin\;C:\Program Files\FWTools1.3.9) in the
PATH environment variable.  I am guessing that this works fine for libraries
but does not help it locate the CSV files, is that correct?  What is the
right way to tell a C# application where/how to find these files?  My
apologies if this is a super basic question or has been answered repeated on
this list - I am obviously new to this...

Any insights would be greatly appreciated.

- Kerry

On Tue, Apr 1, 2008 at 8:16 AM, Frank Warmerdam <warmerdam at pobox.com> wrote:

> 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<http://pobox.com/%7Ewarmerdam>
> and watch the world go round - Rush    | President OSGeo, http://osgeo.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20080401/c20c6fd0/attachment.html


More information about the gdal-dev mailing list