[mapserver-users] Exclude one layer's class from GetLegendGraphics

Rahkonen Jukka (Tike) jukka.rahkonen at mmmtike.fi
Wed Apr 9 23:13:47 PDT 2014


Hi,

For the first question I am remembering that only classes with NAME go to the legend. I may be wrong but you can try it easily.

-Jukka Rahkonen-


gorank wrote:
> 
> Actually i have to questions:
> 
> 1). I have mapfile with few layers. In one layer I have 5 classes with expresions.
> When show legend with GetLegendGraphics always all 5 classes are shown
> although one class is empty (for instance class expression is ([2011] = 0) and in
> the shapefile attributes there is no value 0).
> 
> My question is how to exclude class from the legend. I tried with STATUS OFF in
> the CLASS but do not work.
> 
> 2). I use cyrilic font for polygon labels and for legend titles. When I put class title
> with unicode and save mapfile as unicode, OpenLayers app show empty map in
> the browser. When I put latin text and sava mapfile as ASCII the same map is
> shown in the browser. What i am missing.
> 
> Example from the mapfile.
> CLASS
>       NAME "klasa_1"
>       EXPRESSION ([2011] > 0 and [2011] < 5)
>       LABEL
>         FONT "arial"
>         SIZE 8
>         ENCODING "UTF-8"
>         OFFSET 0 0
>         POSITION CC
>         SHADOWSIZE 1 1
>         TYPE TRUETYPE
>       END # LABEL
>       STYLE
>         COLOR 255 255 128
>         OUTLINECOLOR 130 130 130
>         WIDTH 0.5
>       END # STYLE
>       TITLE "4.9 or less"
>     END # CLASS
>     CLASS
>       NAME "klasa_2"
>       EXPRESSION ([2011] >= 5 and [2011] < 10)
>       LABEL
>         FONT "arial"
>         SIZE 8
>         ENCODING "UTF-8"
>         OFFSET 0 0
>         POSITION CC
>         SHADOWSIZE 1 1
>         TYPE TRUETYPE
>       END # LABEL
>       STYLE
>         COLOR 250 209 85
>         OUTLINECOLOR 130 130 130
>         WIDTH 0.5
>       END # STYLE
>       TITLE "5.0 - 9.9"
>     END # CLASS
>     CLASS
>       NAME "klasa_3"
>       EXPRESSION ([2011] >=10 and [2011] < 15)
>       LABEL
>         FONT "arial"
>         SIZE 8
>         ENCODING "UTF-8"
>         OFFSET 0 0
>         POSITION CC
>         SHADOWSIZE 1 1
>         TYPE TRUETYPE
>       END # LABEL
>       STYLE
>         COLOR 242 167 46
>         OUTLINECOLOR 130 130 130
>         WIDTH 0.5
>       END # STYLE
>       TITLE "10.0 - 14.9"
>     END # CLASS
>     CLASS
>       NAME "klasa_4"
>       EXPRESSION ([2011] >= 15 and [2011] < 20)
>       LABEL
>         FONT "arial"
>         SIZE 8
>         ENCODING "UTF-8"
>         OFFSET 0 0
>         POSITION CC
>         SHADOWSIZE 1 1
>         TYPE TRUETYPE
>       END # LABEL
>       STYLE
>         COLOR 173 83 19
>         OUTLINECOLOR 130 130 130
>         WIDTH 0.5
>       END # STYLE
>       TITLE "15.0 - 19.9"
>     END # CLASS
>     CLASS
>       NAME "klasa_5"
>       EXPRESSION ([2011] >= 20 and [2011] < 10000)
>       LABEL
>         FONT "arial"
>         SIZE 8
>         ENCODING "UTF-8"
>         OFFSET 0 0
>         POSITION CC
>         SHADOWSIZE 1 1
>         TYPE TRUETYPE
>       END # LABEL
>       STYLE
>         COLOR 107 0 0
>         OUTLINECOLOR 130 130 130
>         WIDTH 0.5
>       END # STYLE
>       TITLE "20 and more"
>     END # CLASS
>     CLASS
>       STATUS ON
>       NAME "klasa_0"
>       EXPRESSION ([2011] = 100000)
>       LABEL
>         FONT "arial"
>         SIZE 8
>         ENCODING "UTF-8"
>         OFFSET 0 0
>         POSITION CC
>         SHADOWSIZE 1 1
>         TYPE TRUETYPE
>       END # LABEL
>       STYLE
>         COLOR 100 100 100
>         OUTLINECOLOR 130 130 130
>         WIDTH 0.5
>       END # STYLE
>       TITLE "no event"
>     END # CLASS
>     CLASS
>       STATUS OFF
>       NAME "klasa_00"
>       EXPRESSION ([2011] = 10000)
>       LABEL
>         FONT "arial"
>         SIZE 8
>         ENCODING "UTF-8"
>         OFFSET 0 0
>         POSITION CC
>         SHADOWSIZE 1 1
>         TYPE TRUETYPE
>       END # LABEL
>       STYLE
>         COLOR 200 200 200
>         OUTLINECOLOR 130 130 130
>         WIDTH 0.5
>       END # STYLE
>       TITLE "no event1"
>     END # CLASS
> 
> 
> 
> --
> View this message in context: http://osgeo-org.1560.x6.nabble.com/Exclude-
> one-layer-s-class-from-GetLegendGraphics-tp5134193.html
> Sent from the Mapserver - User mailing list archive at Nabble.com.
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users



More information about the MapServer-users mailing list