<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi list,<br>
<br>
I'm trying to do something I thought would be quire simple, but
seems may not be possible in MapServer. <br>
<br>
I have a client JavaScript application that uses MapServer as a
WMS/WFS backend. The UI has a checkbox that allows the user to see
the data with or without labels. <br>
With the deprecation of the ANNOTATION layer I started to update my
MAPFILE LAYER definitions. Some of the DATA clauses are very
complicated so I moved my LABEL class into the same layer as the
line features which are also colour coded. <br>
<br>
I can switch between by LABEL class and the other classes using
CLASSGROUP and the WMS STYLES parameter. <br>
<br>
E.g. in the MapFile:<br>
<br>
CLASSGROUP "default"<br>
<br>
CLASS<br>
NAME 'Complete'<br>
GROUP "default"<br>
...<br>
END <br>
<br>
CLASS<br>
NAME 'Incomplete'<br>
GROUP "default"<br>
...<br>
END <br>
<br>
# a single class containing labels for all features<br>
CLASS<br>
GROUP "labels" # hidden by default, but can be activated
with STYLE<br>
...<br>
END<br>
<br>
<br>
I can then use the STYLES property of the WMS server to hide/show
labels by requesting the same layer twice with two different styles
e.g. <br>
<br>
No labels: <a class="moz-txt-link-freetext" href="http://localhost/mapserver/?LAYERS=Mylayer......STYLES=">http://localhost/mapserver/?LAYERS=Mylayer......STYLES=</a><br>
Labels:
<a class="moz-txt-link-freetext" href="http://localhost/mapserver/?LAYERS=Mylayer,MyLayer......STYLES=default,labels">http://localhost/mapserver/?LAYERS=Mylayer,MyLayer......STYLES=default,labels</a><br>
<br>
This works well, but has a major drawback that the database is
queried twice for the same data, which in my case causes a
performance issue. Is there anyway to do this in a single-pass
query?<br>
It seems MapServer will only ever apply one class per feature. I
could add a LABEL class to each default CLASS using includes,
however I see no way of then turning these off, except maybe using
MapScript?<br>
Any workarounds / pointers helpful. <br>
<br>
Regards,<br>
<br>
Seth<br>
<br>
<div class="moz-text-html" lang="x-western"> <font color="#888888">--<br>
web:</font><a href="http://geographika.co.uk"><font
color="#888888"> </font>http://geographika.co.uk</a><br>
<font color="#888888">twitter: @geographika<br>
</font><br>
</div>
<br>
</body>
</html>