Reporter: aboudreaultDate: 2011/12/08 - 21:29
This ticket is to track the new keyword of symbol transform order.
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. After some discussions and reviews, we realized that the the functionality is not only related to an arrow but can be applied to other cases. The main issue about this is about the translation and rotation of the 2 symbols... to get them properly rendered. Since MapServer rotate, scale then translate, which is not appropriate for this case... we need a mechanism to inverse that order. That what '''SYMBOLTRANSFORMORDER''' is for: to inverse to order of the operations
We define two symbols: ie. an arrow body and an arrow head.
The arrow head symbol needs to have the ANCHORPOINT set to the left-middle point.
We define 2 styles: one for the body and the other for the head.
The arrow head must specify: SYMBOLTRANSFORMORDER TSR (for the arrow case, we do not need to specify this option for the arrow body style... but it might be required for some rendering case)
For the arrow case, to position the arrow head properly, we need to set the X offset with (size_of_arrow_body/2): for this need, we added the attribute binding ''[uv_length_2]'' (uv layers only).
Here's is a concrete example:
# My symbols
SYMBOL
NAME "arrowbody"
TYPE VECTOR
POINTS
0 0
1 0
END
END
SYMBOL
NAME "arrowhead"
TYPE vector
FILLED true
ANCHORPOINT 0 0.5 # left(x)-middle(y). (See documentation)
POINTS
0 2
2 1
0 0
END
END
# UV Layer example (vector field)
LAYER
NAME uv
TYPE POINT
STATUS default
CONNECTIONTYPE UVRASTER
DATA /mnt/data/raster/grib/wind.vrt
PROJECTION
"init=epsg:4326"
END
PROCESSING "BANDS=1,2"
# PROCESSING "RESAMPLE=AVERAGE" # default
# PROCESSING "UV_SPACING=32" #default
# PROCESSING "UV_SIZE_SCALE=1" #default is 1
CLASS
STYLE
WIDTH 3
SIZE [uv_length]
ANGLE [uv_angle]
SYMBOL "arrowbody"
COLOR 100 255 0
END
STYLE
ANGLE [uv_angle]
SYMBOL "arrowhead"
SYMBOLTRANSFORMORDER TSR
SIZE 10
COLOR 255 0 0
OFFSET [uv_length_2] 0
END
END
END
Reporter: aboudreault Date: 2011/12/08 - 21:29 This ticket is to track the new keyword of symbol transform order.
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. After some discussions and reviews, we realized that the the functionality is not only related to an arrow but can be applied to other cases. The main issue about this is about the translation and rotation of the 2 symbols... to get them properly rendered. Since MapServer rotate, scale then translate, which is not appropriate for this case... we need a mechanism to inverse that order. That what '''SYMBOLTRANSFORMORDER''' is for: to inverse to order of the operations
Here's the approach we would like to use:
Here's is a concrete example: