[mapserver-dev] Upper Limit to Number of Layers in Map file

Frank Warmerdam warmerdam at pobox.com
Tue Apr 21 12:56:59 EDT 2009


Peter Willis wrote:
> Hello,
> 
> I am attempting to use mapserver as a WMS server for
> a large number of rasters.
> 
> The system I am using has a collection of over 21000
> geo-referenced  rasters.
> 
> These can be sorted into various groups, however
> any specific group of rasters may exceed 400 or more.
> 
> I have tried modifying the value MS_MAXLAYERS in
> map.h and recompiling but am unsure if I will exceed
> the binary size of whatever variables are affected by
> that constant.
> 
> What is the maximum, safe, binary size of the
> MS_MAXLAYERS constant that will not overflow
> the variables/procedures that use it?

Peter,

First, I would note that MS_MAXLAYERS was made obsolete in MapServer 5.0.
If you upgrade to at least 5.0 MapServer defaults to dynamic allocation
of the layers array and in theory millions of layers would work. I imagine
you could set MS_MAXLAYERS to a value in excess of 21000 in older versions
if you wanted; however, I think that the memory overhead, and initialization
startup time would likely become painful.

But I really think you need to approach this as a tileindexing issue.
Raster layers can reference an index file containing many individual
raster files that are related in some fashion (for instance spatial
tiles making up a mosaic).  There is also some limited support for
selecting files out of a tileindex based on time ranges that might be
valuable.

If that is not practical - for instance if the rasters are essentially
unrelated and need to be addressed individually - then perhaps you
should consider a dynamic map service using MapScript to to treat each
file/granule/etc as a map service.  This approach might be accomplished
using the MapScript WxS services:

   http://mapserver.org/ogc/mapscript.html

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-dev mailing list