Configuration Options for TextSymbolizer

nameThis is the query field you want to use for the label text, e.g. "street_name"
face_nameFont name
sizeFont size
text_ratio?
wrap_widthLength before wrapping long names
spacingSpace between repeated labels
label_position_toleranceAllow labels to be moved from their point in line placement. Integer value representing distance along a line in line placement mode, defaults to 1/2 min_distance.
force_odd_labelsForce an odd amount of labels to be generated. Defaults to false.
max_char_angle_deltaMaximum angle (in degrees) between two consecutive characters in a label allowed (to stop placing labels around sharp corners) see r365 for more info
fillColor of the text fill, e.g. #FFFFFF
halo_fillColor of the text halo
halo_radiusRadius of the halo in whole pixels (fractional pixels are not accepted)
dx, dyDisplace label by fixed amount on either axis
avoid_edgesBoolean to avoid labeling near intersection edges
min_distanceMinimum distance between repeated labels such as street names or shield symbols
allow_overlapAllow labels to overlap other labels
placement"line" to label along lines instead of by point

Examples

Some examples of Mapnik's ability to place text along lines:

http://trac.mapnik.org/raw-attachment/ticket/62/output_old.png

XML

 <TextSymbolizer name="FIELD_NAME" face_name="DejaVu Sans Book" size="10" fill="black" halo_fill= "White" halo_radius="1" placement="line" allow_overlap="false"/>

See XMLGettingStarted for more XML example uses of TextSymbolizer.

Python

t = TextSymbolizer('FIELD_NAME', 'DejaVu Sans Book', 10, Color('black'))
t.halo_fill = Color('white')
t.halo_radius = 1
t.label_placement = label_placement.LINE_PLACEMENT # POINT_PLACEMENT is default
dir(t) # for the rest of the attributes

C++

FIXME