[mapserver-users] Hide certain symbols from legend

Bob Basques Bob.Basques at ci.stpaul.mn.us
Thu Nov 17 11:28:27 PST 2011


Bob, 

I do this type of thing with a dummy LEGEND block in the Mapfile. 

Map: 
http://gis.ci.stpaul.mn.us/datasets/SHP/METC/TLG/CENTERLINES_TLG/tlg_googlish1_public.map?mapext=544191.4151982379%20135639%20599116.5848017621%20174180&mapsize=1294%20908&mode=map


Legend: 
http://gis.ci.stpaul.mn.us/datasets/SHP/METC/TLG/CENTERLINES_TLG/tlg_googlish1_public.map?mapext=544191.4151982379%20135639%20599116.5848017621%20174180&mapsize=1294%20908&mode=legend


something like this: 

######################## 
##  Legend Chips - This section used exclusively for Legend Generation

##                 Basically these are duplicates of the Style entries

##                 for the separate layer 
######################## 
   
   
  LAYER 
    NAME 'legend_chips' 
    GROUP 'interstate_poly' 
    STATUS DEFAULT 
    TYPE LINE 
#    CLASS 
#      NAME 'US Highway' 
#      STYLE 
#        SYMBOL 'circle' 
#        SIZE 8 
#        COLOR 175 175 175 
#      END 
#      STYLE   
#        SYMBOL 'circle'   
#        SIZE 6   
#        COLOR 255 251 115  
#      END 
#    END 
#    CLASS 
#      NAME 'MN Highway' 
#      STYLE 
#        SYMBOL 'circle' 
#        SIZE 8 
#        COLOR 175 175 175 
#      END 
#      STYLE 
#        SYMBOL 'circle' 
#        SIZE 6 
#        COLOR 255 251 115 
#      END 
#    END 
    CLASS 
      NAME 'Highway or County Road' 
      STYLE 
        SYMBOL 'circle' 
        SIZE 8 
        COLOR 175 175 175 
      END 
      STYLE 
        SYMBOL 'circle' 
        SIZE 6 
        COLOR 255 251 115 
      END 
    END 
    CLASS 
      NAME 'Local Road' 
      STYLE 
        SYMBOL 'circle' 
        SIZE 4 
        COLOR 175 175 175 
      END 
      STYLE 
        SYMBOL 'circle' 
        SIZE 2 
        COLOR 254 254 254 
      END 
    END 
    CLASS 
      NAME 'Ramp' 
      STYLE 
        SYMBOL 'circle' 
        SIZE 4 
        COLOR 175 175 175 
      END 
      STYLE 
        SYMBOL 'circle' 
        SIZE 2 
        COLOR 249 222 77 
      END 
    END 
    CLASS 
     NAME 'Other Street' 
     STYLE 
      SYMBOL 'circle' 
      SIZE 2 
      COLOR 102 102 102 
     END 
    END 
  END 
     
  LAYER 
    NAME 'legend_chips' 
    GROUP 'interstate_poly' 
    STATUS DEFAULT 
    TYPE LINE 
    CLASS 
      NAME 'Interstate' 
STYLE 
        SYMBOL 'circle' 
        SIZE 10 
        COLOR 175 175 175 
      END 
      STYLE 
        SYMBOL 'circle' 
        SIZE 8 
        COLOR 242 191 36  
      END      
#      STYLE 
#        SYMBOL 'interstate1_wide_back' 
#        SIZE 8 
#        COLOR 255 0 0 
#      END 
#      STYLE 
#        SYMBOL 'interstate1_wide_front' 
#        SIZE 8 
#        COLOR 115 113 206 
#        OUTLINECOLOR 254 254 254 
#      END  
    END 
  END 

     
and a chunk of the Symbol definition from the LAYER block: 

############################## 
## Symbols (Shields, etc) 
############################## 

  LAYER 
    METADATA 
      "ows_title" "road_sym" 
      "gml_include_items" "all" 
    END 
     NAME 'road_sym' 
    GROUP 'interstate_poly' 
    #TILEINDEX 'TILEINDEX' 
    DATA 'DATA/A10A20A25A30' 
    STATUS DEFAULT 
    TYPE ANNOTATION 
    CLASSITEM 'F_CLASS' 
    LABELITEM 'HIGHWAY_NU' 
    TOLERANCE 1000 
    CLASS 
      EXPRESSION 'A10' # interstates 
      STYLE 
        SYMBOL 'interstate1_wide_back' 
        SIZE 22 
        COLOR 255 0 0 
      END 
      STYLE 
        SYMBOL 'interstate1_wide_front' 
        SIZE 22 
        COLOR 115 113 206 
        OUTLINECOLOR 254 254 254 
      END       
      LABEL 
        TYPE TRUETYPE 
        FONT bluehigh 
        SIZE 12 
        COLOR 254 254 254 
        MINDISTANCE 200 
        MINFEATURESIZE 10 
        OFFSET 0 0 
        PARTIALS FALSE 
      END 
    END 
     
    CLASS 
      EXPRESSION 'A20' # US Highway 
      STYLE 
        SYMBOL 'us_highway_back' 
        SIZE 23 
        COLOR
 254 254 254 
      END 
      STYLE 
        SYMBOL 'us_highway_front' 
        SIZE 23 
        COLOR 0 0 0 
      END 
      LABEL 
        TYPE TRUETYPE 
        FONT bluehigh 
        SIZE 11 
        COLOR 0 0 0 
        MINDISTANCE 250 
        MINFEATURESIZE 15 
        OFFSET 0 -1 
        PARTIALS FALSE 
      END 
    END 
     
    CLASS 
      EXPRESSION 'A25' # MN Highway 
      STYLE 
        SYMBOL 'mn_highway_back' 
        SIZE 23 
        COLOR 254 254 254 
      END 
      STYLE 
        SYMBOL 'mn_highway_front' 
        SIZE 23 
        COLOR 0 0 0 
      END 
      LABEL 
        TYPE TRUETYPE 
        FONT bluehigh 
        SIZE 11 
        COLOR 0 0 0 
        MINDISTANCE 250 
        MINFEATURESIZE 15 
        OFFSET 0 -1 
        PARTIALS FALSE 
      END 
    END 
     
    CLASS 
      EXPRESSION 'A30' # State Highway 
      STYLE 
        SYMBOL 'state_highway_back' 
        SIZE 23 
        COLOR 254 254 254 
      END 
      STYLE 
        SYMBOL 'state_highway_front' 
        SIZE 23 
        COLOR 0 0 0 
      END 
      LABEL 
        TYPE TRUETYPE 
        FONT bluehigh 
        SIZE 11 
        COLOR 0 0 0 
        MINDISTANCE 250 
        MINFEATURESIZE 15 
        OFFSET 0 -1 
        PARTIALS FALSE 
      END 
    END 
  END 




>>> "Bistrais, Bob" <Bob.Bistrais at maine.gov> wrote:


Here’s one that I thought I remembered seeing somewhere, but can’t
figure it out.  I want to be able to hide certain classes from
displaying in the legend.   
  
I have a layer that depicts public facilities.  I use different colors
to show if each facility has a certain service, or does not.  This
results in a lot of redundant symbols, just of different colors.  I’d
like to show the symbols just once per symbol type, and explain the
colors at the bottom.  Can this be done, or am I imagining things
(again)? 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20111117/43fbdda4/attachment.htm>


More information about the MapServer-users mailing list