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

Ryan, Adam ARyan at co.linn.or.us
Tue Feb 11 12:58:28 EST 2003


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C2D1F7.2E43D580
Content-Type: text/plain;
	charset="iso-8859-1"


I seem to be doing the 'middle road' of Jan's two scenarios.  I build a
number a map files with only the layers I want in them, and then let the
user select a map from a drop-down.  The legend changes accordingly.

There's only one drawback for my set up.  I use a dummy layer to query, a
queryfile to save query results, and 'persist' the results between maps.
Since the queryfile saves the layer index number and not the name, I need
exactly the same number of layers in every map.  It's a pain.

Adam Ryan

-----Original Message-----
From: Jan Hartmann [mailto:jhart at frw.uva.nl]
Sent: Tuesday, February 11, 2003 9:28 AM
To: mapserver-users at lists.gis.umn.edu
Subject: Re: [Mapserver-users] Maximum number of classes/layers (was:
premature end of script headers (php))


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
> 
> --Dylan
> 
> 


_______________________________________________
Mapserver-users mailing list
Mapserver-users at lists.gis.umn.edu
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users

------_=_NextPart_001_01C2D1F7.2E43D580
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2653.12">
<TITLE>RE: [Mapserver-users] Maximum number of classes/layers (was: =
premature end of script headers (php))</TITLE>
</HEAD>
<BODY>
<BR>

<P><FONT SIZE=3D2>I seem to be doing the 'middle road' of Jan's two =
scenarios.&nbsp; I build a number a map files with only the layers I =
want in them, and then let the user select a map from a =
drop-down.&nbsp; The legend changes accordingly.</FONT></P>

<P><FONT SIZE=3D2>There's only one drawback for my set up.&nbsp; I use =
a dummy layer to query, a queryfile to save query results, and =
'persist' the results between maps.&nbsp; Since the queryfile saves the =
layer index number and not the name, I need exactly the same number of =
layers in every map.&nbsp; It's a pain.</FONT></P>

<P><FONT SIZE=3D2>Adam Ryan</FONT>
</P>

<P><FONT SIZE=3D2>-----Original Message-----</FONT>
<BR><FONT SIZE=3D2>From: Jan Hartmann [<A =
HREF=3D"mailto:jhart at frw.uva.nl">mailto:jhart at frw.uva.nl</A>]</FONT>
<BR><FONT SIZE=3D2>Sent: Tuesday, February 11, 2003 9:28 AM</FONT>
<BR><FONT SIZE=3D2>To: mapserver-users at lists.gis.umn.edu</FONT>
<BR><FONT SIZE=3D2>Subject: Re: [Mapserver-users] Maximum number of =
classes/layers (was:</FONT>
<BR><FONT SIZE=3D2>premature end of script headers (php))</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>Just my personal view, but isn't this problem of too =
many classes (or </FONT>
<BR><FONT SIZE=3D2>layers) perhaps caused by using a MapFile in two =
different ways: as a </FONT>
<BR><FONT SIZE=3D2>generator of a single layered map, and as a =
repository of all available </FONT>
<BR><FONT SIZE=3D2>map layers? I can hardly imagine a single map with =
more than fifty </FONT>
<BR><FONT SIZE=3D2>classes or one hundred layers. What people seem to =
do is putting every </FONT>
<BR><FONT SIZE=3D2>GIS file they have in a single MapFile and turning =
layers on and off as </FONT>
<BR><FONT SIZE=3D2>needed. As every layer needs its own classes, the =
maximum number of 50 </FONT>
<BR><FONT SIZE=3D2>is very soon reached, even if only a small part of =
these will be ever </FONT>
<BR><FONT SIZE=3D2>used in any actual map.</FONT>
</P>

<P><FONT SIZE=3D2>In my experience, map layers can be selected much =
more effectively by </FONT>
<BR><FONT SIZE=3D2>just defining the number of layers needed for the =
most complex physical </FONT>
<BR><FONT SIZE=3D2>map, and scripting their DATA statement. So instead =
of an URL like:</FONT>
</P>

<P><FONT SIZE=3D2>.../mapserv?map=3Dmy.map&amp;layers=3Dlayer25 layer33 =
...</FONT>
</P>

<P><FONT SIZE=3D2>do something like:</FONT>
</P>

<P><FONT =
SIZE=3D2>.../mapserv?map=3Dmy.map&amp;layers=3Dlayer1,layer2&amp;map_lay=
er1_data=3D&lt;actual GIS </FONT>
<BR><FONT SIZE=3D2>file 1&gt;&amp;map_layer2_data=3D&lt;actual GIS file =
2&gt;...</FONT>
</P>

<P><FONT SIZE=3D2>The same goes for classes: =
layer1_class0_color=3D&lt;RGB&gt;</FONT>
</P>

<P><FONT SIZE=3D2>See <A =
HREF=3D"http://mapserver.gis.umn.edu/doc36/cgi-reference.html" =
TARGET=3D"_blank">http://mapserver.gis.umn.edu/doc36/cgi-reference.html<=
/A> , at the end.</FONT>
</P>

<P><FONT SIZE=3D2>This moves some bookkeeping from the MapFile to the =
calling Web page. If </FONT>
<BR><FONT SIZE=3D2>you have so many maps that keeping trail of them in =
HTML/JavaScript </FONT>
<BR><FONT SIZE=3D2>would produce a mess, you are probably better off =
using PostGIS as your </FONT>
<BR><FONT SIZE=3D2>map repository. You wouldn't be able to produce a =
Mapfile for this </FONT>
<BR><FONT SIZE=3D2>situation anyway.</FONT>
</P>

<P><FONT SIZE=3D2>Note that in MapServer 3.7 the DATA statement is not =
scriptable by </FONT>
<BR><FONT SIZE=3D2>default any more. For security reasons you have to =
put</FONT>
</P>

<P><FONT SIZE=3D2>DATAPATTERN &lt;regular expression&gt;</FONT>
</P>

<P><FONT SIZE=3D2>in your mapfile. All scripted DATA calls are compared =
with the regular </FONT>
<BR><FONT SIZE=3D2>expression, and only those that match are =
allowed.</FONT>
</P>

<P><FONT SIZE=3D2>Comments, anyone?</FONT>
</P>

<P><FONT SIZE=3D2>Jan Hartmann</FONT>
</P>
<BR>
<BR>
<BR>

<P><FONT SIZE=3D2>Charlton Purvis wrote:</FONT>
<BR><FONT SIZE=3D2>&gt; Thanks for the map.h MS_MAXCLASSES pointer, =
folks, and thanks for the</FONT>
<BR><FONT SIZE=3D2>&gt; user thread pointers, too.&nbsp; I don't know =
why I have such rotten luck</FONT>
<BR><FONT SIZE=3D2>&gt; finding information in the threads, but I =
do.</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; Anyway, I didn't see any clear answers to what =
a reasonable number of</FONT>
<BR><FONT SIZE=3D2>&gt; classes would be, though.&nbsp; Should I look =
at it w/ this attitude:&nbsp; (a)</FONT>
<BR><FONT SIZE=3D2>&gt; I've got 100 classes, so I need to up =
MapServer's anti and simply get</FONT>
<BR><FONT SIZE=3D2>&gt; the job done; OR (b) I need to revisit what I'm =
trying to render because</FONT>
<BR><FONT SIZE=3D2>&gt; 100 classes is unreasonable.</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; Thanks,</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; Charlton</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; -----Original Message-----</FONT>
<BR><FONT SIZE=3D2>&gt; From: Dylan Keon [<A =
HREF=3D"mailto:keon at nacse.org">mailto:keon at nacse.org</A>] </FONT>
<BR><FONT SIZE=3D2>&gt; Sent: Monday, February 10, 2003 5:31 PM</FONT>
<BR><FONT SIZE=3D2>&gt; To: Charlton Purvis</FONT>
<BR><FONT SIZE=3D2>&gt; Cc: mapserver-users at lists.gis.umn.edu</FONT>
<BR><FONT SIZE=3D2>&gt; Subject: Re: [Mapserver-users] premature end of =
script headers (php)</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt; I have about 120 classes I need =
defined in my .map file so that they</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt; can appear as different colors =
(different elevations).&nbsp; Well, all is</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt; well if I display something like 50 =
of those classes.&nbsp; But when I try</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt; to display the 51^st , all goes to =
pot, and I get an internal server</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt; error.&nbsp; I've made sure that my =
classes are intact and syntactically</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt; correct.&nbsp; As long as I don't go =
above the total of 50 classes, I'm</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt; fine.</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; If you are able to recompile MapServer you can =
edit map.h and increase </FONT>
<BR><FONT SIZE=3D2>&gt; MS_MAXCLASSES (default is 50).&nbsp; As long as =
you compile with a value </FONT>
<BR><FONT SIZE=3D2>&gt; greater than the max number of classes you need =
to use, you won't </FONT>
<BR><FONT SIZE=3D2>&gt; receive the error you described.&nbsp; There =
were some posts about this </FONT>
<BR><FONT SIZE=3D2>&gt; recently, and about how many classes are =
reasonable:</FONT>
<BR><FONT SIZE=3D2>&gt; <A =
HREF=3D"http://mapserver.gis.umn.edu/data2/wilma/mapserver-users/0301/th=
reads.ht" =
TARGET=3D"_blank">http://mapserver.gis.umn.edu/data2/wilma/mapserver-use=
rs/0301/threads.ht</A></FONT>
<BR><FONT SIZE=3D2>&gt; ml#00609</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; --Dylan</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
</P>
<BR>

<P><FONT =
SIZE=3D2>_______________________________________________</FONT>
<BR><FONT SIZE=3D2>Mapserver-users mailing list</FONT>
<BR><FONT SIZE=3D2>Mapserver-users at lists.gis.umn.edu</FONT>
<BR><FONT SIZE=3D2><A =
HREF=3D"http://lists.gis.umn.edu/mailman/listinfo/mapserver-users" =
TARGET=3D"_blank">http://lists.gis.umn.edu/mailman/listinfo/mapserver-us=
ers</A></FONT>
</P>

</BODY>
</HTML>
------_=_NextPart_001_01C2D1F7.2E43D580--



More information about the mapserver-users mailing list