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"><<a href="mailto:andy@planetnomad.com">andy@planetnomad.com</a>></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'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( "Corner Coordinates:" );<br>
Console.WriteLine(" Upper Left (" + GDALInfoGetPosition( ds,<br>
0.0, 0.0) + ")");<br>
Console.WriteLine(" Lower Left (" + GDALInfoGetPosition( ds,<br>
0.0, ds.RasterYSize) + ")");<br>
Console.WriteLine(" Upper Right (" + GDALInfoGetPosition( ds,<br>
ds.RasterXSize, 0.0) + ")");<br>
Console.WriteLine(" Lower Right (" + GDALInfoGetPosition( ds,<br>
ds.RasterXSize, ds.RasterYSize) + ")");<br>
Console.WriteLine(" Center (" + GDALInfoGetPosition( ds,<br>
ds.RasterXSize / 2, ds.RasterYSize / 2) + ")");<br>
Console.WriteLine("");<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() + ", " + dfGeoY.ToString();<br>
}<br>
<br>
Example of gdalinfo..<br>
<br>
Corner Coordinates:<br>
Upper Left ( 228000.000, 22200.000) ( 2d 2'53.37"E, 0d12'2.77"N)<br>
Lower Left ( 228000.000, 22000.000) ( 2d 2'53.37"E, 0d11'56.26"N)<br>
Upper Right ( 228200.000, 22200.000) ( 2d 2'59.84"E, 0d12'2.77"N)<br>
Lower Right ( 228200.000, 22000.000) ( 2d 2'59.84"E, 0d11'56.26"N)<br>
Center ( 228100.000, 22100.000) ( 2d 2'56.61"E, 0d11'59.51"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>