get part of very large raster

Frank Warmerdam fwarmerdam at GMAIL.COM
Wed Mar 2 09:36:29 EST 2005


On Wed, 2 Mar 2005 10:11:24 +0100, Ivan Mjartan <ivan.mjartan at geovap.cz> wrote:
>
> Hi, everybody
>
> I have little problem,
>
> I have very large raster over 100M, and I have to programming small program,
> that on input get Xmin, Xmax, Ymin, Ymax and return small wedge of this
> large raster.

Ivan,

Hmm, 100M is large?  It depends on context I suppose.

> My first test was using GD library but problem is that this library  load
> whole raster into memory and its mean, that its take very long time.
>
> I know (I am developing something on mapserver), that mapserver is doing
> this and very fast and my question is, which library mapserver is using , or
>  which part of code is processing this ?

As Bart mentioned, GDAL attempts to provide efficient access to
subregions (and reduced resolutions) of raster files and is used as
the basis of most raster input for rendering in mapserver.

I would add that the organization of the data also plays a role in
efficiency.  If you want to be able to extract subwindows from
a dataset with maximum efficiency it is helpful to ensure the raster
is tiled.  That is internally the image is stored as a bunch of smallish
tiles so that pulling a local area out is just  matter of accessing the
corresponding tiles.  In a normal "scanline oriented image", picking
out a subwindow generally results in paging in the entire scanlines
touched by the subwindow which is pretty inefficient.

If you have a TIFF file that is not tiled, you can convert it to tiled
format with a command like:

 gdal_translate -co TILED=YES in.tif out.tif

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 mapserver-users mailing list