[gdal-dev] Projection of GEOTIFF in C# problems

Tamas Szekeres szekerest at gmail.com
Tue Feb 2 16:18:13 EST 2010


Patrik,

The GDALInfo csharp sample application doesn't exactly follow the C version
by producing the same output. However it's pretty straight forward to report
the projection similarly using the C# API.
I've just added the required changes in the development version:

http://trac.osgeo.org/gdal/changeset/18705

Best regards,

Tamas



2010/2/2 Patrik Svensson <patsv at bredband.net>

>  Hi all,
>
> I have problem with geotiff files created with gdal_translate when I try to
> read them with the C# bindings.
>
> So I tested it with the GDALInfo commands.
>
> GDALInfo.exe  (The c-api) will output the correct projection information:
>
>
>
> *C:\tmp\release-1500-x64-gdal-mapserver\bin>gdal\apps\GDALInfo.exe
> w:\Lmv\F*
>
> *\7h0a.tif*
>
> *Driver: GTiff/GeoTIFF*
>
> *Files: w:\Lmv\Foto\7h\7h0a.tif*
>
> *Size is 5500, 5500 *
>
> *Coordinate System is `'*
>
> *GCP Projection =*
>
> *PROJCS["RT90 2.5 gon V",*
>
> *    **GEOGCS["RT90",*
>
> *        DATUM["Rikets_koordinatsystem_1990",*
>
> *            **SPHEROID["Bessel 1841",6377397.155,299.1528128000009,*
>
> *                AUTHORITY["EPSG","7004"]],*
>
> *            AUTHORITY["EPSG","6124"]],*
>
> *        PRIMEM["Greenwich",0],*
>
> *        UNIT["degree",0.0174532925199433],*
>
> *        AUTHORITY["EPSG","4124"]],*
>
> *    PROJECTION["Transverse_Mercator"],*
>
> *    PARAMETER["latitude_of_origin",0],*
>
> *    PARAMETER["central_meridian",15.80827777777778],*
>
> *    PARAMETER["scale_factor",1],*
>
> *    PARAMETER["false_easting",1500000],*
>
> *    PARAMETER["false_northing",0],*
>
> *    UNIT["metre",1,*
>
> *        AUTHORITY["EPSG","9001"]],*
>
> *    AUTHORITY["EPSG","3021"]]*
>
> *GCP[  0]: Id=1, Info=*
>
> *          (250,250) -> (1550000,6405000,0)*
>
> *GCP[  1]: Id=2, Info=*
>
> *          (5250,250) -> (1555000,6405000,0)*
>
> *GCP[  2]: Id=3, Info=*
>
> *          (250,5250) -> (1550000,6400000,0)*
>
> *GCP[  3]: Id=4, Info=*
>
> *          (5250,5250) -> (1555000,6400000,0)*
>
> *Metadata:*
>
> *  AREA_OR_POINT=Area*
>
> *Image Structure Metadata:*
>
> *  INTERLEAVE=BAND*
>
> *Corner Coordinates:*
>
> *Upper Left  (    0.0,    0.0)*
>
> *Lower Left  (    0.0, 5500.0)*
>
> *Upper Right ( 5500.0,    0.0)*
>
> *Lower Right ( 5500.0, 5500.0)*
>
> *Center      ( 2750.0, 2750.0)*
>
> *Band 1 Block=5500x1 Type=Byte, ColorInterp=Gray*
>
>
>
> But the c-sharp version has problems with projection string as it only
> reports this, lacking the projection data:
>
> *C:\tmp\release-1500-x64-gdal-mapserver\bin>gdal\csharp\GDALInfo.exe
> w:\Lmv\Foto\*
>
> *7h\7h0a.tif*
>
> * *
>
> *Raster dataset parameters:*
>
> *  Projection:*
>
> *  RasterCount: 1*
>
> *  RasterSize (5500,5500)*
>
> *Using driver GeoTIFF*
>
> *  Image Structure Metadata:*
>
> *    0:  INTERLEAVE=BAND*
>
> * *
>
> *Corner Coordinates:*
>
> *  Upper Left (0, 0)*
>
> *  Lower Left (0, 5500)*
>
> *  Upper Right (5500, 0)*
>
> *  Lower Right (5500, 5500)*
>
> *  Center (2750, 2750)*
>
> * *
>
> *GCP Projection:*
>
> *GCP[0]: Id=1, Info=*
>
> *          (250,250) -> (1550000,6405000,0)*
>
> * *
>
> *GCP[1]: Id=2, Info=*
>
> *          (5250,250) -> (1555000,6405000,0)*
>
> * *
>
> *GCP[2]: Id=3, Info=*
>
> *          (250,5250) -> (1550000,6400000,0)*
>
> * *
>
> *GCP[3]: Id=4, Info=*
>
> *          (5250,5250) -> (1555000,6400000,0)*
>
> * *
>
> * *
>
> *GCP Equivalent geotransformation parameters:*
>
> *t[0] = 1549750*
>
> *t[1] = 1*
>
> *t[2] = 0*
>
> *t[3] = 6405250*
>
> *t[4] = 0*
>
> *t[5] = -1*
>
> * *
>
> *Band 1 :*
>
> *   DataType: Byte*
>
> *   ColorInterpretation: Gray*
>
> *   Description:*
>
> *   Size (5500,5500)*
>
> *   BlockSize (5500,1)*
>
> * *
>
> What can I do to get the correct string to give to SpatialReference?
>
> (Tried both GDAL 1.6 and 1.7)
>
> Regards
>
> Patrik Svensson
>
> * *
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20100202/29c0d16e/attachment-0001.html


More information about the gdal-dev mailing list