[gdal-dev] Multifile ArcGrid Issue
Dan Lewis
dlewis at resolvegeo.com
Thu Sep 12 09:22:01 PDT 2013
Hi,
I'm trying to pull elevation data from the GMTED2010 Global Grids, which
are distributed as ESRI ArcGrids (
http://topotools.cr.usgs.gov/GMTED_viewer/gmted2010_global_grids.php).
Here's a minimal program that illustrates my problem:
int main()
{
GDALDataset *poDataset;
GDALAllRegister();
//poDataset = (GDALDataset *) GDALOpen(
"C:/data/GMTED2010/mn30_grd/mn30_grd/w001000.adf", GA_ReadOnly );
poDataset = (GDALDataset *) GDALOpen(
"C:/data/GMTED2010/mn15_grd/mn15_grd/w001000.adf", GA_ReadOnly );
double adfGeoTransform[6];
poDataset->GetGeoTransform( adfGeoTransform );
double latitude = 34.52798, longitude = -112.875733;
//double latitude = 67, longitude = -141;
double x = (longitude - adfGeoTransform[0]) / adfGeoTransform[1];
double y = (latitude - adfGeoTransform[3]) / adfGeoTransform[5];
float val;
poDataset->RasterIO( GF_Read, x, y, 1, 1,
&val, 1, 1, GDT_Float32,
1, NULL, 0, 0, 0 );
std::cout<<"Check elevation at point ("<<x<<", "<<y<<"): "<<val<<"\n";
return 0;
}
I get the following errors:
ERROR 1: Illegal block requested.
ERROR 1: IReadBlock failed at X offset 62, Y offset 742
ERROR 1: GetBlockRef failed at X block offset 62, Y block offset 742
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).
I found an old ticket (#1198) that seems related but has been marked as
fixed.
Any ideas?
Thanks,
Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130912/f89de5f6/attachment.html>
More information about the gdal-dev
mailing list