[gdal-dev] Multifile ArcGrid Issue

Even Rouault even.rouault at mines-paris.org
Fri Sep 13 12:41:41 PDT 2013


Le jeudi 12 septembre 2013 18:22:01, Dan Lewis a écrit :
> 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?

Dan,

This works well for me with GDAL 1.9.2 or above :

$ gdallocationinfo mn15_grd/w001000.adf -geoloc  -112.875733  34.52798
Report:
  Location: (16109P,11873L)
  Band 1:
    Value: 1229

Even

-- 
Geospatial professional services
http://even.rouault.free.fr/services.html


More information about the gdal-dev mailing list