[mapserver-dev] Labeling Highway Shields Idea
Stephen Woodbridge
woodbri at swoodbridge.com
Thu May 21 17:50:59 EDT 2009
Hi all,
Currently, unless I'm out of date, if you want to place highway shields
that are symbols as part of a label you have to use an annotation layer
to place the shield as a symbol(s) and the label over top of that with
the number.
So this requires, two passes over the data, one to render the highways
and a second pass over the data to place the shields. It also requires
defining and maintaining two layers in place of one.
A proposal for an alternate way:
One way to do this would be to allow STYLE block(s) to be placed in the
LABEL block and these would use the base label point and be rendered
before the label text and only if the label test is rendered. I say base
label point, because you would still want to be able to use OFFSET x y
to align the label text with the shield symbols. I suppose you could
allow OFFSET x y in the STYLE block to allow separate positioning of the
symbols and to get multiple symbols to align correctly with one another.
The following is an example of how this might look. Sorry, I copied it
from the cpp input file but it should be easy to understand.
_label(font,size,color) is a macro simplify the files. If USE_SHIELDS is
defined it would use the proposal above and render the interstate
shields which is actually three symbols representing the red, white and
blue parts of the shield where each is a vector symbol or you could have
one STYLE block that uses an image symbol for the shield. If USE_SHIELDS
is not defined then you would get a OSM style highway label in a box,
like "[I-290]".
Thoughts on this?
If people think this would be a good enhancement, I would be happy to
write up a ticket for it.
Thanks,
-Steve
CLASS ## Interstate
EXPRESSION "1"
STYLE
WIDTH _motorway_width
OUTLINEWIDTH 1
OUTLINECOLOR _motorway_ol_clr
MINWIDTH _motorway_minwidth
MAXWIDTH _motorway_maxwidth
END
STYLE
WIDTH _motorway_width
COLOR _motorway_clr
MINWIDTH _motorway_minwidth
MAXWIDTH _motorway_maxwidth
END
#ifdef USE_SHIELDS
LABEL
MAXSCALEDENOM 3000000
STYLE
SYMBOL "interstate-red"
COLOR _red_clr
END
STYLE
SYMBOL "interstate-blue"
COLOR _blue_clr
END
STYLE
SYMBOL "interstate-white"
COLOR _white_clr
END
_label("arial-bold",10,_white_clr)
PRIORITY 1
MINSIZE 8
MAXSIZE 8
MINDISTANCE 150
END
#else
LABEL
MAXSCALEDENOM 3000000
_label("arial-bold",10,_white_clr)
PRIORITY 1
MINSIZE 8
MAXSIZE 8
MINDISTANCE 150
MAXLENGTH 6
BACKGROUNDCOLOR _motorway_lbl_bg_clr
BACKGROUNDSHADOWCOLOR _motorway_lbl_shadow_clr
END
#endif
END
More information about the mapserver-dev
mailing list