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">http://www.osgeo.org/pipermail/gdal-dev/2010-February/023457.html</a> )</div>
<div>But I got lost... :(</div><div><br></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"></blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
<i><span class="Apple-style-span" style="font-size: x-small;">GDALAllRegister();<br></span></i><div><i><span class="Apple-style-span" style="font-size: x-small;">pointerToDataSet=(GDALDataset*) GDALOpen("n30.dt0", GA_ReadOnly);</span></i></div>
<div><span class="Apple-tab-span" style="white-space:pre"><i><span class="Apple-style-span" style="font-size: x-small;">        </span></i></span></div><div><i><span class="Apple-style-span" style="font-size: x-small;">double data[6];</span></i></div>
<div><i><span class="Apple-style-span" style="font-size: x-small;">double longitude, latitude;</span></i></div><div><i><span class="Apple-style-span" style="font-size: x-small;"><br></span></i></div><div><i><span class="Apple-style-span" style="font-size: x-small;">pointerToDataSet->GetGeoTransform(data);</span></i></div>
<div><i><span class="Apple-style-span" style="font-size: x-small;"><br></span></i></div><div><i><span class="Apple-style-span" style="font-size: x-small;">longitude=???;</span></i></div><div><i><span class="Apple-style-span" style="font-size: x-small;">latitude=???;</span></i></div>
<div><span class="Apple-tab-span" style="white-space:pre"><i><span class="Apple-style-span" style="font-size: x-small;">        </span></i></span></div><div><i><span class="Apple-style-span" style="font-size: x-small;">double x = (longitude - pippo[0]) / pippo[1];</span></i></div>
<div><i><span class="Apple-style-span" style="font-size: x-small;">double y = (latitude - pippo[3]) / pippo[5];</span></i></div><div><span class="Apple-tab-span" style="white-space:pre"><i><span class="Apple-style-span" style="font-size: x-small;">        </span></i></span></div>
<div><i><span class="Apple-style-span" style="font-size: x-small;">GDALRasterBand* pointerToBand;</span></i></div><div><span class="Apple-tab-span" style="white-space:pre"><i><span class="Apple-style-span" style="font-size: x-small;">        </span></i></span></div>
<div><i><span class="Apple-style-span" style="font-size: x-small;">pointerToBand=pointerToDataSet->GetRasterBand(1);</span></i></div><div><span class="Apple-tab-span" style="white-space:pre"><i><span class="Apple-style-span" style="font-size: x-small;">        </span></i></span></div>
<div><i><span class="Apple-style-span" style="font-size: x-small;">float *elevation;</span></i></div><div><span class="Apple-tab-span" style="white-space:pre"><i><span class="Apple-style-span" style="font-size: x-small;">        </span></i></span></div>
<div><i><span class="Apple-style-span" style="font-size: x-small;">pointerToDataSet->RasterIO(?,?, ... , ?);</span></i></div><div><div><i><span class="Apple-style-span" style="font-size: x-small;">pointerToBand->RasterIO(?,?, ... , ?);</span></i></div>
</div></blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"></blockquote><div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
</blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"></blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
</blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"></blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
</blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"></blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
</blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"></blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
</blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"></blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
</blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"></blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
</blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"></blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
</blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"></blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
</blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"></blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; 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>