Skip to content

v.out.svg

Exports a vector map to SVG file.

v.out.svg input=name [layer=string] output=name type=string [precision=integer] [attribute=name [,name,...]] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]

Example:

v.out.svg input=name output=name type=poly

grass.script.run_command("v.out.svg", input, layer="-1", output, type="poly", precision=6, attribute=None, overwrite=False, verbose=False, quiet=False, superquiet=False)

Example:

gs.run_command("v.out.svg", input="name", output="name", type="poly")

Parameters

input=name [required]
    Name of input vector map
    Or data source for direct OGR access
layer=string
    Layer number or name ('-1' for all layers)
    A single vector map can be connected to multiple database tables. This number determines which table to use. When used with direct OGR access this is the layer name.
    Default: -1
output=name [required]
    Name for SVG output file
type=string [required]
    Output type
    Defines which feature-type will be extracted
    Allowed values: poly, line, point
    Default: poly
precision=integer
    Coordinate precision
    Default: 6
attribute=name [,name,...]
    Attribute(s) to include in output SVG
--overwrite
    Allow output files to overwrite existing files
--help
    Print usage summary
--verbose
    Verbose module output
--quiet
    Quiet module output
--qq
    Very quiet module output
--ui
    Force launching GUI dialog

input : str, required
    Name of input vector map
    Or data source for direct OGR access
    Used as: input, vector, name
layer : str, optional
    Layer number or name ('-1' for all layers)
    A single vector map can be connected to multiple database tables. This number determines which table to use. When used with direct OGR access this is the layer name.
    Used as: input, layer
    Default: -1
output : str, required
    Name for SVG output file
    Used as: output, file, name
type : str, required
    Output type
    Defines which feature-type will be extracted
    Allowed values: poly, line, point
    Default: poly
precision : int, optional
    Coordinate precision
    Default: 6
attribute : str | list[str], optional
    Attribute(s) to include in output SVG
    Used as: input, dbcolumn, name
overwrite: bool, optional
    Allow output files to overwrite existing files
    Default: False
verbose: bool, optional
    Verbose module output
    Default: False
quiet: bool, optional
    Quiet module output
    Default: False
superquiet: bool, optional
    Very quiet module output
    Default: False

DESCRIPTION

v.out.svg converts GRASS vector data to SVG (Scalable Vector Graphics) code notation. In particular, it

  • converts GRASS line, boundary, area, point, centroid objects to SVG \<path />, \<circle /> elements,
  • reduces coordinate precision in SVG-output to save bandwidth,
  • extracts GRASS attributes to gg:name="value" attributes.

The precision parameter controls the number of decimals for coordinates output (precision=0 corresponds to integer precision in the output SVG file).

EXAMPLE

Export polygons from GRASS vector map soils (Spearfish sample data) to SVG format:

v.out.svg input=soils output=/tmp/output.svg type=poly

Export lines from GRASS vector map t_hydro (Spearfish sample data) to SVG format, set coordinate precision to 0:

v.out.svg input=t_hydro output=/tmp/output.svg type=line precision=0

Export points from GRASS vector map archsites (Spearfish sample data) to SVG format, include attribute str1 (name):

v.out.svg input=archsites output=/tmp/output.svg type=point precision=0 attrib=str1

REFERENCES

SEE ALSO

v.out.ogr

AUTHOR

Klaus Foerster (klaus svg.cc), Innsbruck, Austria

SOURCE CODE

Available at: v.out.svg source code (history)
Latest change: Friday Feb 07 19:16:09 2025 in commit a82a39f