Andrew,<br><br>Take a look at how it is done in gdalinfo here: <a href="http://trac.osgeo.org/gdal/browser/trunk/gdal/apps/gdalinfo.c#L680">http://trac.osgeo.org/gdal/browser/trunk/gdal/apps/gdalinfo.c#L680</a><br><br><div class="gmail_quote">
On Tue, Sep 1, 2009 at 8:19 PM, coastalrocket <span dir="ltr">&lt;<a href="mailto:andy@planetnomad.com">andy@planetnomad.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Hello all,<br>
<br>
I&#39;m very much new to GDAL and have been for the last couple of days<br>
following the c# implementation examples. I have noticed that the corner<br>
coordinates output of gdalinfo for my image will contain the projected<br>
coordinate values followed by the unprojected latitude / longitude values. I<br>
have not been able to find a similar technique in the c# examples or through<br>
the class descriptions. I suppose I can take the projection information and<br>
turn to Proj4 to convert the projected coordinates but since gdalinfo in<br>
command line form is spitting out these values I thought they would be<br>
available through the c# gdal libraries. Is this the case or am i missing<br>
something?<br>
<br>
Many thanks,<br>
Andrew<br>
<br>
In the example GDALInfo.cs<br>
<br>
Console.WriteLine( &quot;Corner Coordinates:&quot; );<br>
            Console.WriteLine(&quot;  Upper Left (&quot; + GDALInfoGetPosition( ds,<br>
0.0, 0.0) + &quot;)&quot;);<br>
            Console.WriteLine(&quot;  Lower Left (&quot; + GDALInfoGetPosition( ds,<br>
0.0, ds.RasterYSize) + &quot;)&quot;);<br>
            Console.WriteLine(&quot;  Upper Right (&quot; + GDALInfoGetPosition( ds,<br>
ds.RasterXSize, 0.0) + &quot;)&quot;);<br>
            Console.WriteLine(&quot;  Lower Right (&quot; + GDALInfoGetPosition( ds,<br>
ds.RasterXSize, ds.RasterYSize) + &quot;)&quot;);<br>
            Console.WriteLine(&quot;  Center (&quot; + GDALInfoGetPosition( ds,<br>
ds.RasterXSize / 2, ds.RasterYSize / 2) + &quot;)&quot;);<br>
            Console.WriteLine(&quot;&quot;);<br>
<br>
and..<br>
<br>
private static string GDALInfoGetPosition(Dataset ds, double x, double y)<br>
    {<br>
        double[] adfGeoTransform = new double[6];<br>
        double  dfGeoX, dfGeoY;<br>
        ds.GetGeoTransform(adfGeoTransform);<br>
<br>
        dfGeoX = adfGeoTransform[0] + adfGeoTransform[1] * x +<br>
adfGeoTransform[2] * y;<br>
        dfGeoY = adfGeoTransform[3] + adfGeoTransform[4] * x +<br>
adfGeoTransform[5] * y;<br>
<br>
        return dfGeoX.ToString() + &quot;, &quot; + dfGeoY.ToString();<br>
    }<br>
<br>
Example of gdalinfo..<br>
<br>
Corner Coordinates:<br>
Upper Left  (  228000.000,   22200.000) (  2d 2&#39;53.37&quot;E,  0d12&#39;2.77&quot;N)<br>
Lower Left  (  228000.000,   22000.000) (  2d 2&#39;53.37&quot;E,  0d11&#39;56.26&quot;N)<br>
Upper Right (  228200.000,   22200.000) (  2d 2&#39;59.84&quot;E,  0d12&#39;2.77&quot;N)<br>
Lower Right (  228200.000,   22000.000) (  2d 2&#39;59.84&quot;E,  0d11&#39;56.26&quot;N)<br>
Center      (  228100.000,   22100.000) (  2d 2&#39;56.61&quot;E,  0d11&#39;59.51&quot;N)<br>
<br>
Apologies if this post appears twice. My first was rejected through me not<br>
subscribing before sending.<br>
<font color="#888888">--<br>
View this message in context: <a href="http://n2.nabble.com/c-corner-coordinates-in-latitude-longitude-tp3560997p3560997.html" target="_blank">http://n2.nabble.com/c-corner-coordinates-in-latitude-longitude-tp3560997p3560997.html</a><br>

Sent from the GDAL - Dev mailing list archive at Nabble.com.<br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</font></blockquote></div><br><br>Best regards,<br>-- <br>Chaitanya kumar CH.<br>