Creates an SVG svg
document element from an array of content elements.
content
- an array oftext
values output as the content of the<svg>
elementviewbox
- [optional] value of SVG viewBox attribute (x y width height
)- see
svgViewbox
- see
width
- [optional] width of viewheight
- [optional] height of viewstyle
- [optional] specifies CSS styling at the document level- see
svgStyle
,svgStyleProp
- see
def
- [optional] specifies a definition
Returns an SVG viewBox
attribute value determined from the envelope of a geometry.
extent
- ageometry
providing the envelope to encode.
The PostGIS ST_Extent
aggregate function can be use to determine the overall
envelope of the geometries being encoded.
Creates an SVG g
group element from an array of content elements.
content
- an array oftext
values output as the content of the<g>
elementclass
- [optional] class attributeid
- [optional] id attributestyle
- [optional] style attribute value- see
svgStyle
- see
attr
- [optional] additional attributes
Encodes a PostGIS geometry as an SVG shape.
geom
- geometry to encodeclass
- [optional] class attributeid
- [optional] id attributestyle
- [optional] style attribute value- see
svgStyle
- see
attr
- [optional] additional attributestitle
- [optional] titleradius
- [optional] radius of point circle
Encodes an array of XY ordinates as an SVG polygon
.
pts
- array of X Y ordinatesclass
- [optional] class attributeid
- [optional] id attributestyle
- [optional] style attribute value- see
svgStyle
- see
attr
- [optional] additional attributestitle
- [optional] title
Encodes an array of XY ordinates as an SVG polygon
.
x
- X location of bottom-left cornery
- Y location of bottom-left cornerwidth
- rectangle widthheight
- rectangle heightrx
- [optional] corner radius X dimensionry
- [optional] corner radius Y dimensionclass
- [optional] class attributeid
- [optional] id attributestyle
- [optional] style attribute value- see
svgStyle
- see
attr
- [optional] additional attributestitle
- [optional] title
Creates an SVG ellipse
with centre x, y
and radii rx
and ry
x
- X location of bottom-left cornery
- Y location of bottom-left cornerwidth
- rectangle widthheight
- rectangle heightclass
- [optional] class attributeid
- [optional] id attributestyle
- [optional] style attribute value- see
svgStyle
- see
attr
- [optional] additional attributestitle
- [optional] title
Encodes text starting at position loc
as an SVG text
element.
loc
- Point geometry giving location of textcontent
- text valueclass
- [optional] class attributeid
- [optional] id attributestyle
- [optional] style attribute valueattr
- [optional] additional attributestitle
- [optional] title
Relevant style CSS properties include:
text-anchor
- value ofstart | middle | end | inherit
font
- full font specifier. E.g.10px Verdana,Helvetica,Arial,sans-serif
font-style
- value ofnormal | italic | oblique
font-weight
- value ofnormal | bold | bolder | lighter | <number>
Encodes an array of name,value pairs as a string of SVG CSS name: value;
properties
param ...
- list of name/value pairs
Common styling CSS properties are given below. For full list see W3C SVG spec.
fill
- fill colorfill-opacity
- opacity of fill; value in [ 0,1 ]stroke
- line colorstroke-dasharray
- dashed line specifier, e.g.2,4,1,4
stroke-dashoffset
- offset of dashesstroke-width
- line widthfont
- font specifier in the formstyle variant weight size family
CSS color specifiers include:
#RRGGBB
colorname
hsl(h,s,l)
- can use thesvgHSL
function to create thisurl(#id)
- reference to a gradient definition
Generates an SVG CSS style
value from the following parameters:
fill
- fill colorfillopacity
- opacity of fill; value in [ 0,1 ]stroke
- line colorstrokewidth
- line widthfill-opacity
- opacity of stroke; value in [ 0,1 ]font
- font specifier in the formstyle variant weight size family
css
- array of name,value pairs specifying additional CSS properties
Encodes Red,Bliue,Green values as a CSS HSL function rgb(R,G,B)
.
red
- a value in 0..255green
- a value in 0..255blue
- a value in 0..255
Encodes Hue,Saturation,Lightness values as a CSS HSL function hsl(H,S,L)
.
hue
- a hue value in degrees (from 0 through 360, with 0 = red, 120 = green, and 240 = blue)saturation
- [optional] a percentage, default 100lightness
- [optional] a percentage, default 50
Returns an SVG linearGradient
definition element.
The element is provided as a def
to svgDoc
.
A CSS fill
property value can refer to the gradient using the specifier url(#id)
id
- the gradient idcolor1
- the start color of the gradientcolor2
- the end color of the gradient
Returns a random integer from the range [lo, hi] (inclusive)
Returns a random item from an array of integers
Returns a random item from an array of integers