[mapserver-users] Raster Data and Memory

Frank Warmerdam warmerdam at pobox.com
Wed Oct 30 17:04:28 EST 2002


Benjamin Wragg wrote:

> Hi guys,
>
> I was wondering how MapServer handles raster data. I've seen the large 
> list of image formats that are supported, but what does MapServer do 
> with the images when it loads them up? Does it try and fit the whole 
> image into memory? If this is the case, what happens if say the image 
> is 2GB and I have 512MB of memory, will it continue to try and load 
> the file into memory, causing (on windows) the swap file to be used, 
> or will it just not load the file into memory and call the file from 
> the disk when needed?
>
> Thanks,
>
> Benjamin Wragg
>
Benjamin,

What happens depends on a number of factors, mostly on what format 
driver is being used.
The built-in PNG, and GIF drivers load the whole source image into 
memory.  The built-in
JPEG and TIFF drivers scan through the image a line or strip at a time 
collecting the data
required for the display.

The GDAL driver passes control down to it's internal drivers to handling 
loading the desired
subsampled region.  Some of these drivers can do so quite efficiently 
... for instance from
TIFF view overviews built.  At worst most will scan the whole image to 
pick out the portions
needed without having to load the whole thing.

In short, be aware of the format and the characteristics of the driver 
you are using for large
images.  Generally if you want to handle a large image I would suggest 
storing it in GeoTIFF
with overviews pre-built.  Other approaches (tiling and separate layers 
for different resolutions)
can also be appropriate.   The RASTER HOWTO should address some of the 
performance issues.

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