Label Class with expressions
Travis Kirstine GIS Tech
tkirstine at JDBARNES.COM
Fri Jan 20 06:30:46 PST 2006
Hi,
I'm having some issues when trying to label one layer that has 2 classes
with the same expression one for drawing and one for labeling.
Below are two examples the first show how if I use two layers everything
works fine but when I combine the labels and the lines the label aren't
drawn
When you combine them into two layers the labeling works
#EXAMPLE 1 ########################
#<<<<<<<<<<<<-------- ROADS---------->>>>>>>>>>>>>>
LAYER
#DATA test/map_app_data/road_web
DATA umap_display_data/road_web
NAME "Roads"
METADATA
DESCRIPTION "Roads"
RESET "ON"
END
TYPE LINE
STATUS off
MAXSCALE 1500000
MINSCALE 50001
CLASS
NAME "Major Roads" # HIGHWAYS/MAJOR ROADS
MAXSCALE 1000000
MINSCALE 50001
EXPRESSION ([RD_CLASS]=1)
SYMBOL 0
COLOR 100 100 100
#SIZE 2
END
CLASS
NAME "Secondary Roads" # SECONDARY ROADS
MAXSCALE 300000
MINSCALE 50001
EXPRESSION ([RD_CLASS]=2)
SYMBOL 0
COLOR 120 120 120
#SIZE 2
END
CLASS
NAME "Local Roads" # LOCAL ROADS
MAXSCALE 100000
MINSCALE 50001
EXPRESSION ([RD_CLASS]=3)
SYMBOL 0
COLOR 140 140 140
#SIZE 1
END
END
#<<<<<<<<<<<-----ROAD LABELS--------->>>>>>>>>
LAYER
#DATA test/map_app_data/road_web
DATA umap_display_data/road_web
NAME "Road Labels"
METADATA
DESCRIPTION "no display"
RESET "ON"
END
TYPE ANNOTATION
STATUS ON
MAXSCALE 1000000
MINSCALE 500
LABELMAXSCALE 1000000
LABELMINSCALE 500
LABELITEM "STREETNAME"
CLASS
MAXSCALE 125000
MINSCALE 500
EXPRESSION ([RD_CLASS]=1)
LABEL
MINDISTANCE 300
TYPE truetype
COLOR 125 15 25
OUTLINECOLOR 253 253 253
FONT verdana
SIZE 8
ANTIALIAS true
ANGLE Auto
POSITION cc
END
END
CLASS
MAXSCALE 50000
MINSCALE 500
EXPRESSION ([RD_CLASS]=2)
LABEL
MINDISTANCE 300
ANTIALIAS true
TYPE truetype
COLOR 125 15 25
OUTLINECOLOR 253 253 253
FONT verdana
SIZE 8
ANGLE Auto
POSITION cc
BUFFER 10
END
END
CLASS
MAXSCALE 10000
MINSCALE 500
EXPRESSION ([RD_CLASS]=3)
LABEL
MINDISTANCE 300
TYPE truetype
ANTIALIAS true
COLOR 125 15 25
OUTLINECOLOR 253 253 253
FONT verdana
SIZE 8
ANGLE Auto
POSITION cc
END
END
END
# EXAMPLE 2 ##############################
#<<<<<<<<<<<<-------- ROADS With LABELS---------->>>>>>>>>>>>>>
LAYER
#DATA test/map_app_data/road_web
DATA umap_display_data/road_web
NAME "Roads"
METADATA
DESCRIPTION "Roads"
RESET "ON"
END
TYPE LINE
STATUS off
MAXSCALE 1500000
MINSCALE 500
LABELMAXSCALE 1000000
LABELMINSCALE 500
LABELITEM "STREETNAME"
CLASS
NAME "Major Roads" # HIGHWAYS/MAJOR ROADS
MAXSCALE 1000000
MINSCALE 50001
EXPRESSION ([RD_CLASS]=1)
SYMBOL 0
COLOR 100 100 100
#SIZE 2
END
CLASS
MAXSCALE 125000
MINSCALE 500
EXPRESSION ([RD_CLASS]=1)
LABEL
MINDISTANCE 300
TYPE truetype
COLOR 125 15 25
OUTLINECOLOR 253 253 253
FONT verdana
SIZE 8
ANTIALIAS true
ANGLE Auto
POSITION cc
END
END
CLASS
NAME "Secondary Roads" # SECONDARY ROADS
MAXSCALE 300000
MINSCALE 50001
EXPRESSION ([RD_CLASS]=2)
SYMBOL 0
COLOR 120 120 120
#SIZE 2
END
CLASS
MAXSCALE 50000
MINSCALE 500
EXPRESSION ([RD_CLASS]=2)
LABEL
MINDISTANCE 300
ANTIALIAS true
TYPE truetype
COLOR 125 15 25
OUTLINECOLOR 253 253 253
FONT verdana
SIZE 8
ANGLE Auto
POSITION cc
BUFFER 10
END
END
CLASS
NAME "Local Roads" # LOCAL ROADS
MAXSCALE 100000
MINSCALE 50001
EXPRESSION ([RD_CLASS]=3)
SYMBOL 0
COLOR 140 140 140
#SIZE 1
END
CLASS
MAXSCALE 10000
MINSCALE 500
EXPRESSION ([RD_CLASS]=3)
LABEL
MINDISTANCE 300
TYPE truetype
ANTIALIAS true
COLOR 125 15 25
OUTLINECOLOR 253 253 253
FONT verdana
SIZE 8
ANGLE Auto
POSITION cc
END
END
END
Travis
More information about the MapServer-users
mailing list