Returns an SVG figure representing a geometry value.
SELECT NEW ST_Polygon( 'Polygon(( 0 0, 0 20, 60 10, 0 0 ))' ) .ST_AsSVG()
The following returns a complete SVG document with outlined polygons and limits coordinates to 3 digits after the decimal place.
SELECT NEW ST_Polygon( 'Polygon(( 0 0, 0 20, 60 10, 0 0 ))' ) .ST_AsSVG( 'RandomFill=No;DecimalDigits=3' )
The following returns a complete SVG documents with polygons filled with blue and coordinates with maximum precision.
SELECT Shape.ST_AsSVG( 'Attribute=fill="blue";DecimalDigits=-1' ) FROM SpatialShapes
The following returns a complete SVG document from SVG path data with relative coordinates limited to 5 digits after the decimal place.
SELECT '<?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg viewBox="-180 -90 360 180" xmlns="http://www.w3.org/2000/svg" version="1.1"> <path fill="lightblue" stroke="black" stroke-width="0.1%" d="' || NEW ST_Polygon( 'Polygon(( 0 0, 0 20, 60 10, 0 0 ))' ) .ST_AsSVG( 'PathDataOnly=Yes' ) || '"/></svg>'
The following returns SVG path data using absolute coordinates limited to 7 digits after the decimal place.
SELECT NEW ST_Polygon( 'Polygon(( 0 0, 0 20, 60 10, 0 0 ))' ) .ST_AsSVG( 'PathDataOnly=Yes;Relative=No;DecimalDigits=7' )
SQL/MM (ISO/IEC 13249-3: 2006) Vendor extension