Hi list,

I'm trying to do something I thought would be quire simple, but seems may not be possible in MapServer.

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

I can switch between by LABEL class and the other classes using CLASSGROUP and the WMS STYLES parameter.

E.g. in the MapFile:

    CLASSGROUP "default"

    CLASS
        NAME 'Complete'
        GROUP "default"
        ...
    END

    CLASS
        NAME 'Incomplete'
        GROUP "default"
        ...
    END

   # a single class containing labels for all features
    CLASS
        GROUP "labels" # hidden by default, but can be activated with STYLE
    ...
    END


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.

No labels: http://localhost/mapserver/?LAYERS=Mylayer......STYLES=
Labels: http://localhost/mapserver/?LAYERS=Mylayer,MyLayer......STYLES=default,labels

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? 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?
Any workarounds / pointers helpful.

Regards,

Seth

--
web:http://geographika.co.uk
twitter: @geographika


_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to