[gdal-dev] Extract data from a.dem file
Even Rouault
even.rouault at mines-paris.org
Mon Sep 6 13:30:26 EDT 2010
Yes , what you see is expected.
The prototype of RasterIO() is :
RasterIO( flag, x, y, width, height, buffer, buffer_width, buffer_height,
gdal_type, pixel_offset, line_offset)
so that means that you ask the extraction of the window [x, x + with-1] x [y,
y + height -1] to be stored in a buffer_width x buffer_height buffer.
so if you set x to be non-null, you cannot ask for the full XSize to be read,
the maximum value for width is XSize - x.
See http://gdal.org/classGDALRasterBand.html#5497e8d29e743ee9177202cb3f61c3c7
for the full reference.
Le lundi 06 septembre 2010 17:25:31, Carmelo Terrasi a écrit :
> Hello everybody,
> I'm trying to figure out how to get elevation from a .dem file.
>
> I opened the file:
> ...
> pointerToDataSet=(GDALDataset*) GDALOpen("myFile.dem", GA_ReadOnly);
> ...
>
>
> So I caught a grid as a 371x371 matrix, but I can read only the first line,
> so the first 371 elevations... the error is: *...Access window out of range
> in RasterIO()...*
>
> I mean If I put coordinates like (*0*, *somethingelse*) where 0<*
> somethingelse<*370:
> ...
> pointerToBand->RasterIO( GF_Read, 0, *somethingelse*, nXSize, 1, elevation,
> nXSize, 1, GDT_Float32, 0, 0 );
> ...
> that's ok
>
>
>
> Instead if I put coordinates (*x*, *somethingelse*) where
> 0<*somethingelse*<370 and
> 0<*x*:
> ...
> pointerToBand->RasterIO( GF_Read, *x*, *somethingelse*
> , nXSize, 1, elevation, nXSize, 1, GDT_Float32, 0, 0 );
> ...
> that doesn't work :(
>
> I opened myFile.dem with a text editor and I've seen the whole matrix as a
> linecode values...
> There's something I cannot understand obviously, any tips would be really
> appreciated, thanks in advance,
> Regards
> Carmelo
More information about the gdal-dev
mailing list