<div dir="ltr">Hi,<div><br></div><div>I'm trying to pull elevation data from the GMTED2010 Global Grids, which are distributed as ESRI ArcGrids (<a href="http://topotools.cr.usgs.gov/GMTED_viewer/gmted2010_global_grids.php" target="_blank">http://topotools.cr.usgs.gov/GMTED_viewer/gmted2010_global_grids.php</a>). </div>
<div><br></div><div>Here's a minimal program that illustrates my problem:</div><div><br></div><div><div>int main()</div><div>{</div><div> GDALDataset *poDataset;</div><div><br></div><div> GDALAllRegister();</div>
<div><br></div><div> //poDataset = (GDALDataset *) GDALOpen( "C:/data/GMTED2010/mn30_grd/mn30_grd/w001000.adf", GA_ReadOnly );</div><div> poDataset = (GDALDataset *) GDALOpen( "C:/data/GMTED2010/mn15_grd/mn15_grd/w001000.adf", GA_ReadOnly );</div>
<div><br></div><div> double adfGeoTransform[6];</div><div> poDataset->GetGeoTransform( adfGeoTransform );</div><div> </div><div> double latitude = 34.52798, longitude = -112.875733;</div><div> //double latitude = 67, longitude = -141;</div>
<div> </div><div> double x = (longitude - adfGeoTransform[0]) / adfGeoTransform[1];</div><div> double y = (latitude - adfGeoTransform[3]) / adfGeoTransform[5];</div><div><br></div><div> float val;</div><div> poDataset->RasterIO( GF_Read, x, y, 1, 1, </div>
<div> &val, 1, 1, GDT_Float32, </div><div> 1, NULL, 0, 0, 0 );</div><div> std::cout<<"Check elevation at point ("<<x<<", "<<y<<"): "<<val<<"\n";</div>
<div> </div><div> return 0;</div><div>}</div></div>
<div><div><br></div><div>I get the following errors:</div><div><br></div><div>ERROR 1: Illegal block requested.</div><div>ERROR 1: IReadBlock failed at X offset 62, Y offset 742</div><div>ERROR 1: GetBlockRef failed at X block offset 62, Y block offset 742</div>
<div><br></div><div>It works as expected if I pull from locations earlier in the file (64, -141) or if I use a lower resolution file (mn30_grd).</div><div><br></div><div>I found an old ticket (#1198) that seems related but has been marked as fixed. </div>
<div><br></div><div>Any ideas?</div><div><br></div><div>Thanks,</div><div><br></div><div>Daniel</div>
</div></div>