[mapserver-dev] vector symbols

thomas bonfort thomas.bonfort at gmail.com
Thu Feb 10 05:17:50 EST 2011


Devs, and more particularly Steve and Tamas,

We have a problem with regards to vector symbol handling in mapserver.
Basically, GD handles the vector points as full pixels, whereas AGG
and Cairo treats them as paths that can be stroked or filled.
This leads to a discrepancy when calculating the width and height of
the symbol, which are needed to calculate the scale factor that must
be applied when the symbol is associated with a style size.
For example:
POINTS
  0 0
  0 1
END
end up with a symbol who's size is 1x2 for GD, and a 1 pixel stroke
for AGG/CAIRO.

POINTS
  0 0
  0 4
  4 4
  4 0
  0 0
  -99 -99
  2 2
END
in GD is a 5 pixel square with a dot in the middle, and in AGG/CAIRO
is a 4 pixel square with no dot as the second part (2 2) is a
degenerate path. I know Tamas extensively uses the GD way of defining
symbols, by creating vector symbols that are basically a bitmap whose
color can be changed by style color. It works and allows to create
repeating symbols that fit nicely together, but fails whenever the
user applies a SIZE to the symbol. I consider this "abusing" the
vector symbol meaning by relying on GD quirks, but understand that
this is a behavior that we might want to keep. Thoughts?

I'm not sure what we can do to have backwards compatibility with GD
vector symbols and at the same time have a consistent cross-renderer
output. In the current state, this seems impossible to me. I see two
ways of moving forwards:
 * remove backwards compatibility with GD vector symbols, and treat
vector points as paths
 * define a new symbol who's points are treated as a path, and
interpret vector symbol points as pixels.For this new symbol, I would
definitely recommend that the points be generated on a grid where
(0,0) represents the anchor point of the symbol.

I hope I'm being clear in exposing the problem.


More information about the mapserver-dev mailing list