OK, I got it, it works, thank you so much!!!<div><br><div class="gmail_quote">2010/8/31 J Luis <span dir="ltr"><<a href="mailto:jmfluis@gmail.com">jmfluis@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div bgcolor="#ffffff" text="#000000">
Carmelo,<br>
<br>
In GMT with GDAL support that is trivial to do using the grdtrack
program.<br>
<br>
Joaquim Luis<br>
<br>
<br>
<blockquote type="cite"><div><div></div><div class="h5">Hello everybody,<br>
<div>first of all my apologies cause I'm a newbie with this stuff...</div>
<div><br>
</div>
<div>I'm trying to build a function able to extract altitude from
latitude and longitude as parameters.</div>
<div>Something like that: <b>double MyElevation(double lat, double
lon)</b></div>
<div><b><br>
</b></div>
<div>I'm using Dted level 0 to get the elevation (I've already read
this post: <a href="http://www.osgeo.org/pipermail/gdal-dev/2010-February/023457.html" target="_blank">http://www.osgeo.org/pipermail/gdal-dev/2010-February/023457.html</a> )</div>
<div>But I got lost... :(</div>
<div><br>
</div>
<blockquote style="border:medium none;margin:0pt 0pt 0pt 40px;padding:0px"><i><span style="font-size:x-small">GDALAllRegister();<br>
</span></i>
<div><i><span style="font-size:x-small">pointerToDataSet=(GDALDataset*)
GDALOpen("n30.dt0", GA_ReadOnly);</span></i></div>
<div><span style="white-space:pre-wrap"><i><span style="font-size:x-small"> </span></i></span></div>
<div><i><span style="font-size:x-small">double
data[6];</span></i></div>
<div><i><span style="font-size:x-small">double
longitude, latitude;</span></i></div>
<div><i><span style="font-size:x-small"><br>
</span></i></div>
<div><i><span style="font-size:x-small">pointerToDataSet->GetGeoTransform(data);</span></i></div>
<div><i><span style="font-size:x-small"><br>
</span></i></div>
<div><i><span style="font-size:x-small">longitude=???;</span></i></div>
<div><i><span style="font-size:x-small">latitude=???;</span></i></div>
<div><span style="white-space:pre-wrap"><i><span style="font-size:x-small"> </span></i></span></div>
<div><i><span style="font-size:x-small">double
x = (longitude - pippo[0]) / pippo[1];</span></i></div>
<div><i><span style="font-size:x-small">double
y = (latitude - pippo[3]) / pippo[5];</span></i></div>
<div><span style="white-space:pre-wrap"><i><span style="font-size:x-small"> </span></i></span></div>
<div><i><span style="font-size:x-small">GDALRasterBand*
pointerToBand;</span></i></div>
<div><span style="white-space:pre-wrap"><i><span style="font-size:x-small"> </span></i></span></div>
<div><i><span style="font-size:x-small">pointerToBand=pointerToDataSet->GetRasterBand(1);</span></i></div>
<div><span style="white-space:pre-wrap"><i><span style="font-size:x-small"> </span></i></span></div>
<div><i><span style="font-size:x-small">float
*elevation;</span></i></div>
<div><span style="white-space:pre-wrap"><i><span style="font-size:x-small"> </span></i></span></div>
<div><i><span style="font-size:x-small">pointerToDataSet->RasterIO(?,?,
... , ?);</span></i></div>
<div>
<div><i><span style="font-size:x-small">pointerToBand->RasterIO(?,?,
... , ?);</span></i></div>
</div>
</blockquote>
<div>
<blockquote style="border:medium none;margin:0pt 0pt 0pt 40px;padding:0px"></blockquote>
<blockquote style="border:medium none;margin:0pt 0pt 0pt 40px;padding:0px"></blockquote>
<blockquote style="border:medium none;margin:0pt 0pt 0pt 40px;padding:0px"></blockquote>
<blockquote style="border:medium none;margin:0pt 0pt 0pt 40px;padding:0px"></blockquote>
<blockquote style="border:medium none;margin:0pt 0pt 0pt 40px;padding:0px"></blockquote>
<blockquote style="border:medium none;margin:0pt 0pt 0pt 40px;padding:0px"></blockquote>
<blockquote style="border:medium none;margin:0pt 0pt 0pt 40px;padding:0px"></blockquote>
<blockquote style="border:medium none;margin:0pt 0pt 0pt 40px;padding:0px"></blockquote>
<blockquote style="border:medium none;margin:0pt 0pt 0pt 40px;padding:0px"></blockquote>
<blockquote style="border:medium none;margin:0pt 0pt 0pt 40px;padding:0px"></blockquote>
<div><br>
</div>
</div>
<div>I supposed I had to store elevation data into the buffer I
created, I mean the float pointer.</div>
<div>I got confused among these:</div>
<div>- the file *.dt0 </div>
<div>- longitude and latitude </div>
<div>- parameters for RasterIO()</div>
<div><br>
</div>
<div>Every tips will be very appreciated, thanks a lot for your
patience,</div>
<div>Regards,</div>
<div>Carmelo</div>
</div></div><pre><fieldset></fieldset>
_______________________________________________
gdal-dev mailing list
<div class="im"><a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a></div></pre>
</blockquote>
<br>
</div>
</blockquote></div><br></div>