mapscript.labelObj

class mapscript.labelObj

The LABEL object

Overview

The labelObj has the following relationships:

../../../_images/labelObj_classObj.png ../../../_images/labelObj_legendObj.png ../../../_images/labelObj_scalebarObj.png

Attributes

align

int See ALIGN

angle

double See ANGLE

anglemode

enum MS_POSITIONS_ENUM One of AUTO AUTO2, or FOLLOW - see ANGLE

autominfeaturesize

int MS_TRUE or MS_FALSE

buffer

int Space to reserve around a label (padding) - see BUFFER

color

colorObj Foreground color - see COLOR

encoding

char Supported encoding format to be used for labels - see ENCODING

font

char Name of TrueType font see FONT

force

int Indicates if labels must be drawn - see FORCE

maxlength

int See MAXLENGTH

maxoverlapangle

double See MAXOVERLAPANGLE

maxscaledenom

double See MAXSCALEDENOM

maxsize

int Maximum height in pixels for scaled labels.

mindistance

int Minimum distance in pixels between duplicate labels - see MINDISTANCE

minfeaturesize

int Minimum feature size (in pixels) to label, features of this size or greater will be labeled - see MINFEATURESIZE

minlength

int This is a valid Mapfile keyword but is currently unused

minscaledenom

double See MINSCALEDENOM

minsize

int Minimum height in pixels - see MINSIZE

numstyles

int The number of styles associated with the label

offsetx

int Horizontal offset of label - see OFFSET

offsety

int Vertical offset of label - see OFFSET

outlinecolor

colorObj Color of one point outline - see OUTLINECOLOR

outlinewidth

int See OUTLINEWIDTH

partials

int Indicates if labels can run off the edge of an image, either MS_TRUE or MS_FALSE (default) - see PARTIALS

position

int See POSTION

priority

int Priority level 1 to MS_MAX_LABEL_PRIORITY, default=1 - see PRIORITY

refcount

int immutable TODO Add documentation

repeatdistance

int See REPEATDISTANCE

shadowcolor

colorObj See SHADOWCOLOR

shadowsizex

int See SHADOWSIZE

shadowsizey

int See SHADOWSIZE

size

int Annotation height in pixels - see SIZE

sizeunits

int Supersedes class's sizeunits, defaults to MS_INHERIT.

space_size_10

double Cached size of a single space character used for label text alignment of rfc40

thisown

The membership flag

wrap

char See WRAP

Methods

__init__()[source]

Create a new labelObj. A labelObj is associated with a classObj a scalebarObj or a legendObj. An instance of labelObj can exist outside of a classObj container and be explicitly inserted into the classObj:

>>> new_label = new labelObj()
>>> the_class.addLabel(new_label)
convertToString() char[source]

Output the labelObj object as a Mapfile string. Provides the inverse option for labelObj.updateFromString().

getBinding(binding: int) char[source]

Get the attribute binding for a specified label property. Returns NULL if there is no binding for this property.

getExpressionString() char[source]
getStyle(i: int) mapscript.styleObj[source]

Return a reference to the styleObj at index i in the styles array.

getTextString() char[source]
insertStyle(style: mapscript.styleObj, index: int = - 1) int[source]

Insert a copy of style into the styles array at index index. Default is -1, or the end of the array. Returns the index at which the style was inserted.

moveStyleDown(index: int) int[source]

Swap the styleObj at index with the styleObj index + 1.

moveStyleUp(index: int) int[source]

Swap the styleObj at index with the styleObj index - 1.

removeBinding(binding: int) int[source]

Remove the attribute binding for a specified label property.

removeStyle(index: int) mapscript.styleObj[source]

Remove the styleObj at index from the styles array and return a copy.

setBinding(binding: int, item: char) int[source]

Set the attribute binding for a specified label property. Binding constants look like this: MS_LABEL_BINDING_[attribute name]:

>>> new_label.setBinding(MS_LABEL_BINDING_COLOR, "FIELD_NAME_COLOR")
setExpression(expression: char) int[source]

Set the label expression.

setText(text: char) int[source]

Set the label text.

updateFromString(snippet: char) int[source]

Update a labelObj from a string snippet. Returns MS_SUCCESS or MS_FAILURE