MapServer / MapServer-import

3 stars 2 forks source link

POLAROFFSET (was SYMBOLTRANSFORMORDER) for special symbols rendering #2277

Open mapserver-bot opened 12 years ago

mapserver-bot commented 12 years ago

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

- RST: Rotate, scale, translate (default)                                                                                           
- TSR: Translate, scale, rotate                                                              

Here's the approach we would like to use:

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
mapserver-bot commented 12 years ago

Author: tbonfort Date: 2011/12/09 - 10:18