| Maptitude GISDK Help |
Changes the manual label settings for a layer.
In Version 6.0/2012 is still available but will now do nothing if called.
SetManualLabels(string lyr_name, string label_expr, array options)
| Argument | Contents |
|---|---|
| lyr_name | The name of the layer, or null for the current layer |
| label_expr | A field name, or an expression whose result is used as the label |
| Option | Type | Contents |
|---|---|---|
| Alignment | String | Desired label position relative to the feature, expressed as a compass direction ("NW", "N", "NE", "W", "C", "E", "SW', S", "SE") |
| Color | Color | Label color |
| Font | String | Font name, size and style |
| Format | String | Format to use when labeling a numeric field |
| Frame Border Style | Linestyle | Style of the frame border |
| Frame Border Color | Color | Color of the frame border |
| Frame Border Width | Real | Width of the frame in points |
| Frame Fill Color | Color | Color of the interior of the frame |
| Frame Fill Style | Fillstyle | Style used for the interior of the frame |
| Frame Shield | Array | The highway shield definition (string font_name, array of (integer index, color)). |
| Frame Type | String | Shape of the frame ("ellipse", "ectangle", "rounded rectangle", or "shield") |
| Framed | Boolean | Whether or not frames should be displayed around each label |
| Rotation | Boolean | Whether line labels should be rotated to align with the line feature |
To add a manual label, use AddAnnotation() and add an annotation of type Label. The manual label settings are automatically applied to the annotation.
// Set up for manual labeling
lyr = "U.S. States"
SetLayer(lyr)
SetManualLabels(lyr, "Name", {
{"Font", "Arial|Bold|16"},
{"Color", ColorRGB(50000,50000,0)}
})
// Have the user click on a feature and get its ID
pt = ClickCoord()
id = RH2ID(LocateNearestRecord(pt, 0.25))
place_at_cursor = 1
relative_pos = "NE"
// When auto placing (placing at the location an auto label would be anchored),
// only the coord from "Location" is used
opts = { {"ID", id}, {"Layer", lyr} }
if place_at_cursor = 1 then opts = opts + { {"Place Auto", "False"},
{"Location", {pt, relative_pos}} }
else opts = opts + { {"Place Auto", "True" }, {"Location", {pt, "N"}} }
// Add a manual label annotation
AddAnnotation( , "Label", opts)
| Error Type | Meaning |
|---|---|
| Error | The label expression or an option is invalid or the specified layer does not exist |
| Function | Summary |
|---|---|
| AddAnnotation() | Adds an annotation to a map or layout window |
| GetManualLabelOptions() | Gets the manual label settings for a layer |
| SetLabels() | Enables or disables labeling for a layer or selection set |
| ©2025 Caliper Corporation | www.caliper.com |