<span lang="EN-US">Patrik,<br><br>You could do something like:<br><br>GCP[] GCPs = dataset.GetGCPs();<br>double[] adfGeoTransform= new double[6];<br>Gdal.GCPsToGeoTransform(GCPs, adfGeoTransform, 0);<br><br>// apply the transformation<br>
dfGeoX = adfGeoTransform[0] + adfGeoTransform[1] * X + adfGeoTransform[2] * Y;<br>dfGeoY = adfGeoTransform[3] + adfGeoTransform[4] * X + adfGeoTransform[5] * Y;<br><br>// calculate the inverse (handling det=0 would also be required)<br>
double det = adfGeoTransform[1] * adfGeoTransform[5] - adfGeoTransform[2] * adfGeoTransform[4];<br>X = ((dfGeoX - adfGeoTransform[0]) * adfGeoTransform[5] - (dfGeoY - adfGeoTransform[3]) * adfGeoTransform[2]) / det;<br>X = ((dfGeoY - adfGeoTransform[3]) * adfGeoTransform[1] - (dfGeoX - adfGeoTransform[0]) * adfGeoTransform[4]) / det;<br>
<br>BTW: I recall I already have an open ticket to add these functions (by exposing GDALApplyGeoTransform and GDALInvGeoTransform would be sufficient) in the SWIG interface<br><a href="http://trac.osgeo.org/gdal/ticket/1531">http://trac.osgeo.org/gdal/ticket/1531</a><br>
<br><br>Best regards,<br><br>Tamas<br><br><br></span><br><div class="gmail_quote">2009/6/27 patsv <span dir="ltr"><<a href="mailto:patsv@bredband.net">patsv@bredband.net</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div link="blue" vlink="purple" lang="SV">
<div>
<p><span lang="EN-US">Hi, all this is my first post to this list.</span></p>
<p><span lang="EN-US">I am fiddling with some gps data that I
want to plot onto a .BSB chart.</span></p>
<p><span lang="EN-US">I think I have understood howto project the
gps data to geo-coordinates with the spatialreference and transformpoints.</span></p>
<p><span lang="EN-US"> And then it seems possible to
translate from screen to geo-coordinates with GCPToGeoTransform.</span></p>
<p><span lang="EN-US">But how to do the inverse geo-coordinate to
screen with GCP.</span></p>
<p><span lang="EN-US">It seems that the GDALCreateGCPTransformer
and GDALGCPTransform can do both.</span></p>
<p><span lang="EN-US">But I cannot find the support in C# or is
it hidden in some class?</span></p>
<p><span lang="EN-US"> </span></p>
<p><span lang="EN-US">Regards</span></p>
<p><span lang="EN-US">Patrik Svensson</span></p>
<p><span lang="EN-US"> </span></p>
</div>
</div>
<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></blockquote></div><br>