v.label.sa
Create optimally placed labels for vector map(s)
v.label.sa map=name [type=string [,string,...]] [layer=string] column=string labels=name font=string [size=float] [isize=float] [charset=string] [color=string] [hcolor=string] [hwidth=float] [background=string] [opaque=yes|no] [border=string] [width=float] [--verbose] [--quiet] [--qq] [--ui]
Example:
v.label.sa map=name column=string labels=name font=string
grass.script.run_command("v.label.sa", map, type="point,line,area", layer="1", column, labels, font, size=100, isize=10, charset="UTF-8", color="black", hcolor="none", hwidth=0, background="none", opaque="yes", border="none", width=0, verbose=False, quiet=False, superquiet=False)
Example:
gs.run_command("v.label.sa", map="name", column="string", labels="name", font="string")
Parameters
map=name [required]
Name of vector map
Or data source for direct OGR access
type=string [,string,...]
Input feature type
Allowed values: point, line, area
Default: point,line,area
layer=string
Layer number or name
Vector features can have category values in different layers. This number determines which layer to use. When used with direct OGR access this is the layer name.
Default: 1
column=string [required]
Name of attribute column to be used for labels
labels=name [required]
Name for new paint-label file
font=string [required]
Name of TrueType font (as listed in the fontcap)
size=float
Label size (in map-units)
Default: 100
isize=float
Icon size of point features (in map-units)
Default: 10
charset=string
Character encoding (default: UTF-8)
Default: UTF-8
color=string
Text color
Allowed values: aqua, black, blue, brown, cyan, gray, green, grey, indigo, magenta, orange, purple, red, violet, white, yellow
Default: black
hcolor=string
Highlight color for text
Allowed values: none, aqua, black, blue, brown, cyan, gray, green, grey, indigo, magenta, orange, purple, red, violet, white, yellow
Default: none
hwidth=float
Width of highlight coloring
Default: 0
background=string
Background color
Allowed values: none, aqua, black, blue, brown, cyan, gray, green, grey, indigo, magenta, orange, purple, red, violet, white, yellow
Default: none
opaque=yes|no
Opaque to vector (only relevant if background color is selected)
Allowed values: yes, no
Default: yes
border=string
Border color
Allowed values: none, aqua, black, blue, brown, cyan, gray, green, grey, indigo, magenta, orange, purple, red, violet, white, yellow
Default: none
width=float
Border width (only for ps.map output)
Default: 0
--help
Print usage summary
--verbose
Verbose module output
--quiet
Quiet module output
--qq
Very quiet module output
--ui
Force launching GUI dialog
map : str, required
Name of vector map
Or data source for direct OGR access
Used as: input, vector, name
type : str | list[str], optional
Input feature type
Allowed values: point, line, area
Default: point,line,area
layer : str, optional
Layer number or name
Vector features can have category values in different layers. This number determines which layer to use. When used with direct OGR access this is the layer name.
Used as: input, layer
Default: 1
column : str, required
Name of attribute column to be used for labels
labels : str, required
Name for new paint-label file
Used as: name
font : str, required
Name of TrueType font (as listed in the fontcap)
size : float, optional
Label size (in map-units)
Default: 100
isize : float, optional
Icon size of point features (in map-units)
Default: 10
charset : str, optional
Character encoding (default: UTF-8)
Default: UTF-8
color : str, optional
Text color
Allowed values: aqua, black, blue, brown, cyan, gray, green, grey, indigo, magenta, orange, purple, red, violet, white, yellow
Default: black
hcolor : str, optional
Highlight color for text
Allowed values: none, aqua, black, blue, brown, cyan, gray, green, grey, indigo, magenta, orange, purple, red, violet, white, yellow
Default: none
hwidth : float, optional
Width of highlight coloring
Default: 0
background : str, optional
Background color
Allowed values: none, aqua, black, blue, brown, cyan, gray, green, grey, indigo, magenta, orange, purple, red, violet, white, yellow
Default: none
opaque : str, optional
Opaque to vector (only relevant if background color is selected)
Used as: yes|no
Allowed values: yes, no
Default: yes
border : str, optional
Border color
Allowed values: none, aqua, black, blue, brown, cyan, gray, green, grey, indigo, magenta, orange, purple, red, violet, white, yellow
Default: none
width : float, optional
Border width (only for ps.map output)
Default: 0
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.label.sa makes a label-file from a GRASS vector map with labels created from attributes in the attached table. The labels are placed in as optimal place as possible. The label file has the same syntax as the one created by v.label
EXAMPLE
North Carolina example:
# get font names:
d.font -L
v.label.sa roadsmajor labels=roads_labels column=ROAD_NAME color=red \
background=white size=250 font=Vera
# set region:
g.region raster=lsat7_2002_10 -p
# display:
d.rgb b=lsat7_2002_10 g=lsat7_2002_20 r=lsat7_2002_30
d.vect roadsmajor col=yellow
d.labels roads_labels
Road labeling with v.label.sa (Raleigh, North Carolina, USA, area)
REFERENCES
Edmondson, Christensen, Marks and Shieber: A General Cartographic Labeling Algorithm, Cartographica, Vol. 33, No. 4, Winter 1996, pp. 13-23 The algorithm works by the principle of Simulated Annealing.
SEE ALSO
v.label
d.labels
ps.map Wikipedia article on simulated
annealing
AUTHOR
Wolf Bergenheim
SOURCE CODE
Available at: v.label.sa source code
(history)
Latest change: Wednesday Apr 02 17:48:37 2025 in commit 571253a