[mapserver-dev] SYMBOLTRANFORM for special symbols rendering
Alan Boudreault
aboudreault at mapgears.com
Thu Nov 24 11:25:30 EST 2011
Hi devs,
A while ago, it has been discussed about a new way to render a symbol,
which in this case is an arrow. The need is to be able to draw the body
arrow (a line) scaled depending of a value (ie, the magnitude in vector
field) but to not scale the arrow head.
Mike, Daniel and Thomas discussed this problem in Denver during FOSS4G
and they came up with the concept of ARROWBODY and ARROWHEAD. Those
concepts are essentially to determine what need to be scaled. Following
a discussion this morning.. here's the approach we would like to use:
* We define two symbols: the arrow body and the arrow head.
* The arrow head symbol needs to have the ANCHORPOINT set to the head.
* We define 2 styles: one for the body and the other for the head.
* The two style would use a new option: SYMBOLTRANSFORM, which is to
draw the symbol correctly (scalable of not).
Mapfile example:
SYMBOL
NAME "arrowbody"
TYPE vector
FILLED true
POINTS
0 0
1 0
END
END
SYMBOL
NAME "arrowhead"
TYPE vector
FILLED true
ANCHORPOINT 0.25 0
POINTS
0 0.25
0.25 0
0 -0.25
END
END
# in the layer definition....
STYLE
SYMBOLTRANSFORM arrowbody
WITDH 1
SIZE [uv_length]
ANGLE [uv_angle]
END
STYLE
SYMBOLTRANSFORM arrowhead
SYMBOL "arrowhead"
ANGLE [uv_angle]
OFFSET [uv_length] 0
SIZE 4
END
In the arrowhead, we *NEED* to pass the length of the arrowbody (via
OFFSET), since it will be used to determine where the arrow head should
be positioned. the SYMBOLTRANSFORM arrowhead option would tell the
symbol renderer TO NOT scaled the symbol in length. In this example, we
use the terminology arrowbody/arrowhead.... but we are going to use
generic terms to use that feature in other cases.
I'm glad to hear your comments and suggestions about that approach!
Regards,
Alan
More information about the mapserver-dev
mailing list