Just a quick use case, we required a circle symbol in Mapserver, but our current circles were based on a single point, giving us poor legend outputs (i.e. a . instead of a o )
Mapserver vector symbols are defined using a cartesian coordinates system (no surprises there!), so all we needed was enough points to represent the circle on screen. Some code is shown below, for a circle of diameter 12 pixels, and 6 segments per quadrant.
pts <- seq(-pi,pi, pi/12) points <- seq(-pi,pi, pi/12) radius <- 6 x <- cos(points) * radius y <- sin(points) * radius round(cbind(x,y), 2)
This gives a list of points thus:
x y [1,] -6.00 0.00 [2,] -5.80 -1.55 [3,] -5.20 -3.00 [4,] -4.24 -4.24 [5,] -3.00 -5.20 [6,] -1.55 -5.80 [7,] 0.00 -6.00 [8,] 1.55 -5.80 [9,] 3.00 -5.20 [10,] 4.24 -4.24 [11,] 5.20 -3.00 ... [25,] -6.00 0.00
(tip: on a Mac hold down option while clicking and dragging to select only the numbers you require.)
Our final symbol file looks like:
SYMBOLSET SYMBOL # 37 NAME 'circle_12px' TYPE VECTOR FILLED true POINTS -5.00 0.00 -4.83 -1.29 -4.33 -2.50 -3.54 -3.54 -2.50 -4.33 -1.29 -4.83 0.00 -5.00 1.29 -4.83 2.50 -4.33 3.54 -3.54 4.33 -2.50 4.83 -1.29 5.00 0.00 4.83 1.29 4.33 2.50 3.54 3.54 2.50 4.33 1.29 4.83 0.00 5.00 -1.29 4.83 -2.50 4.33 -3.54 3.54 -4.33 2.50 -4.83 1.29 -5.00 0.00 END END END