[Mapserver-users] Maximum number of classes/layers (was: premature end of script headers (php))

Dylan Keon keon at nacse.org
Tue Feb 11 10:04:30 PST 2003


As I understand it, MS_MAXCLASSES restricts applications to 50 classes 
*per layer*, not across the entire mapfile.  I think it's probably 
difficult for most anyone to distinguish among 50+ classes, but there 
are cases where that many classes are warranted.  For example, if you 
just want the visual effect of that many classes and use effective 
labeling along with it, or if the layer in question is scale-dependent. 
  Or in the case of Charlton's elevation layer, where it sounds like he 
wants fine-grained rendering of his color ramp.

--Dylan

Jan Hartmann wrote:
> Just my personal view, but isn't this problem of too many classes (or 
> layers) perhaps caused by using a MapFile in two different ways: as a 
> generator of a single layered map, and as a repository of all available 
> map layers? I can hardly imagine a single map with more than fifty 
> classes or one hundred layers. What people seem to do is putting every 
> GIS file they have in a single MapFile and turning layers on and off as 
> needed. As every layer needs its own classes, the maximum number of 50 
> is very soon reached, even if only a small part of these will be ever 
> used in any actual map.
> 
> In my experience, map layers can be selected much more effectively by 
> just defining the number of layers needed for the most complex physical 
> map, and scripting their DATA statement. So instead of an URL like:
> 
> .../mapserv?map=my.map&layers=layer25 layer33 ...
> 
> do something like:
> 
> .../mapserv?map=my.map&layers=layer1,layer2&map_layer1_data=<actual GIS 
> file 1>&map_layer2_data=<actual GIS file 2>...
> 
> The same goes for classes: layer1_class0_color=<RGB>
> 
> See http://mapserver.gis.umn.edu/doc36/cgi-reference.html , at the end.
> 
> This moves some bookkeeping from the MapFile to the calling Web page. If 
> you have so many maps that keeping trail of them in HTML/JavaScript 
> would produce a mess, you are probably better off using PostGIS as your 
> map repository. You wouldn't be able to produce a Mapfile for this 
> situation anyway.
> 
> Note that in MapServer 3.7 the DATA statement is not scriptable by 
> default any more. For security reasons you have to put
> 
> DATAPATTERN <regular expression>
> 
> in your mapfile. All scripted DATA calls are compared with the regular 
> expression, and only those that match are allowed.
> 
> Comments, anyone?
> 
> Jan Hartmann
> 
>
> Charlton Purvis wrote:
> 
>> Thanks for the map.h MS_MAXCLASSES pointer, folks, and thanks for the
>> user thread pointers, too.  I don't know why I have such rotten luck
>> finding information in the threads, but I do.
>>
>> Anyway, I didn't see any clear answers to what a reasonable number of
>> classes would be, though.  Should I look at it w/ this attitude:  (a)
>> I've got 100 classes, so I need to up MapServer's anti and simply get
>> the job done; OR (b) I need to revisit what I'm trying to render because
>> 100 classes is unreasonable.
>>
>> Thanks,
>>
>> Charlton
>>
>> -----Original Message-----
>> From: Dylan Keon [mailto:keon at nacse.org] Sent: Monday, February 10, 
>> 2003 5:31 PM
>> To: Charlton Purvis
>> Cc: mapserver-users at lists.gis.umn.edu
>> Subject: Re: [Mapserver-users] premature end of script headers (php)
>>
>>  > I have about 120 classes I need defined in my .map file so that they
>>  > can appear as different colors (different elevations).  Well, all is
>>  > well if I display something like 50 of those classes.  But when I try
>>  > to display the 51^st , all goes to pot, and I get an internal server
>>  > error.  I've made sure that my classes are intact and syntactically
>>  > correct.  As long as I don't go above the total of 50 classes, I'm
>>  > fine.
>>
>> If you are able to recompile MapServer you can edit map.h and increase 
>> MS_MAXCLASSES (default is 50).  As long as you compile with a value 
>> greater than the max number of classes you need to use, you won't 
>> receive the error you described.  There were some posts about this 
>> recently, and about how many classes are reasonable:
>> http://mapserver.gis.umn.edu/data2/wilma/mapserver-users/0301/threads.ht
>> ml#00609




More information about the MapServer-users mailing list