GeoScript

Previous topic

Fill

Next topic

Icon

This Page

Stroke

class geoscript.style.stroke.Stroke(color='#000000', width=1, dash=None, cap=None, join=None)

Symbolizer for linear geometries that consists of a color and a width.

>>> Stroke('#00ff00', 4)
Stroke(color=(0,255,0),width=4)

The color argument may also be specified as a well known name or as an rgb tuple.

>>> stroke = Stroke('green', 4)
>>> stroke = Stroke((0,255,0), 4)

The dash argument specifies a dashed stroke pattern as a list of values. Oddly positioned elements specify the length in pixels of the dash. Evenly positioned elements specify the spaces.

>>> stroke = Stroke('green', 4, [2,1,3,2])

The dash argument may also be specified as a tuple in which the first element is specifies the dash pattern described above, and the second element is an offset into the array which specifies where to begin the pattern from.

>>> stroke = Stroke('green', 4, ([2,1,3,2], 2))

The cap argument specifies how lines should be capped. Supported values include “butt”, “round”, and “square”. The ``join``argument specifies how two lines should be joined. Supported values include “miter”, “round”, and “bevel”.

hatch(name, stroke=None, size=None)

Composes the stroke with a hatched pattern.

The name argument is the well known name of the hatch pattern. See Hatch for the list of supported names.

The stroke and size argument specify the Stroke and size to use for the hatch pattern respectively.

>>> stroke = Stroke().hatch('vertline')