GeoScript

Previous topic

Icon

Next topic

Font

This Page

Label

class geoscript.style.label.Label

Symbolizer for labelling a geometry.

The property argument specifies the field or attribute with which to generate labels from.

The font and color arguments specify the label font and color respectively.

>>> Label('foo')
Label(property=foo)
font(font)

Sets the font for this label. The font argument is a string describing the font attributes. See Font for supported syntax.

>>> label = Label('foo').font('italic bold 12px "Times New Roman"')
halo(fill=None, radius=None)

Generates a halo for this label.

The fill and radius arguments specify the Fill and radius to use for the halo.

>>> from geoscript.style import Fill
>>> label = Label('foo').halo(Fill('#ffffff'), 2)
icon(url, format=None, size=None)

Composes this label as an Icon.

The url argument is the url/file containing the image. The format argument is the format or mime type of the image.

line(offset=0, gap=None, igap=None, align=False, follow=False, group=False, displace=None, repeat=None)

Sets the label placement relative to a line.

The offset argument specifies the perpindicular distance from the line at which to position the label.

The align argument specifies whether to align the label along the line. The follow argument specifies whether to curve the label in order to force it to follow the line.

>>> label = Label('foo').linear(align=True, follow=True)
linear(*args, **kwargs)

Use geoscript.style.Label.line()

point(anchor=(0.5, 0.5), displace=(0, 0), rotate=0)

Sets the label placement relative to a point.

The anchor argument is a tuple that specifies how the label should be anchored along an xy axis relative to the geometry being labeled. Allowable values range from (0,0) to (1,1) ordered from the bottom left corner to the top right corner of the label.

The displacement argument is a tuple that specifies how the label should be displaced along an xy axis.

The rotate argument specifies in degrees the angle at which to rotate the label.

>>> label = Label('foo').point((0.5,0), (0,5))