This topic describes the ST_AsSVG function. This function returns the Scalar Vector Graphics (SVG) path data that represents a geometry object or a geography object.

Syntax

text  ST_AsSVG(geometry  geom , integer  rel , integer  maxdecimaldigits);
text  ST_AsSVG(geography  geog , integer  rel , integer  maxdecimaldigits);

Parameters

Parameter Description
geom The geometry object whose SVG representation you want to obtain.
rel Specifies whether to use relative moves. Default value: 0, which specifies to use absolute moves. You can set this parameter to 1, which specifies to use relative moves to implement path data.
maxdecimaldigits The maximum number of decimal places that you want to retain. Default value: 15.
geog The geography object whose SVG representation you want to obtain.

Examples

SELECT ST_AsSVG(ST_GeomFromText('POINT(116 40)',4326));
     st_assvg
-------------------
 cx="116" cy="-40"
(1 row)