[Gdal-dev] RasterIO() speed
Frank Warmerdam
warmerdam at pobox.com
Fri Jun 4 16:24:19 EDT 2004
Gerald Brandt wrote:
> Hi,
>
> I have a loaded DEM file (USGSDEM/USGS Optional ASCII DEM) of Lake
> Tahoe. It's size is 3516 x 8430 x 1.
>
> My command is
>
> dataset->GetRasterBand(1)->RasterIO(GF_Read, xpixel, yline, 1, 1,
> &elevation, 1, 1, GDT_Float64, 0, 0) ;
>
> With and xpixel value of 329 and a yline value of 4199.
>
> The RasterIO() call takes 340 seconds on a Pentium 4 2.8 GHz
> hyper-threaded system. The cpu sits between 17% and 25% while in the
> call. Is this normal, and if so, is there a way that I can speed up the
> process other than caching the elevation in my own array for every point
> in the grid?
Gerald,
This is an unusually large USGS DEM ASCII file. I gather this is not a
standard product?
The USGS DEM driver (unlike most other drivers) just reads the whole
file into memory. I think it is cached, so subsequent reads should
be essentially instant. If not, just read the whole file into memory and
close the file then access the data from your memory array.
For most formats GDAL only loads parts of the file as needed and endevours
to avoid using too much memory. USGS DEM is an exception.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the Gdal-dev
mailing list