Labels
<< Click to Display Table of Contents >> Navigation: Layers > Labels |
In JMap, labels are text that is related to map elements. They are used to display information about the elements on the map. For example, you can use labels to display the city names for a layer of points representing cities.
Labels can either be placed manually using the labeling tool or generated automatically by JMap at display time. Depending on the type of elements of the layer, the labeling configuration section can slightly vary.
Example of curved labels (left) and labels with a frame (right)
Example of labels with a background symbol
Labeling is configured by specifying text that defines the label's content; this text can contain static parts, variable parts (functions) and JavaScript programs. At display time, functions are executed and replaced by the result. For example, the ElementValue(attrib)function (or ev(attrib), in its short form) will be replaced by the value of the corresponding attribute. JavaScript programs can be used to perform operations on attribute values. Label text can span multiple lines.
The functions supported by labels are the same as those supported by mouseover. For more information on these functions, refer to the Mouseover section.
Labeling parameters |
|||||
Label text |
The text of the label. Static parts will be displayed as is and ev(attrib) functions will be replaced by the corresponding bound attribute values. Unlike mouseover bubbles, labels don't support HTML formatting or hyperlinks. See the following examples:
Labels also support JavaScript programming to perform mathematical operations as well as operations on character strings using attribute values. The print function is used to print content in the label. Area: ev(area_km2) km2 <script> var SQ_KM_IN_SQ_MI = 2.58998811; var area_sq_mi = ev(area_km2) / SQ_KM_IN_SQ_MI; print(area_sq_mi.toFixed(1) + " sq. mi"); </script> leads to Area : 91935.7 km2 31635.6 sq. mi |
Label style |
|
Font |
Select the font to use to display the labels. |
Size |
Select the size of the font. |
Bold, Italic, Underline, Striked through |
Select the font attributes. |
Outlined |
Select this option to display an outline around the label text. This makes it easier to read labels on the map. |
Use antialiasing |
Select this option to enable antialiasing. |
Text color |
Select the color of the label text. |
Outline color |
If the Outlined option is selected, choose the color of the outline. White is the default. |
Automatic labeling
Automatic labeling adds labels to map elements automatically, without user interaction. For each vector layer, you can enable or disable automatic labeling and define scales between which automatic labeling will be activated. It is often useful to set a minimum scale limit for automatic labeling to avoid overcrowding the map.
Also, in order to avoid overcrowding the map, three tools allow you to control the order or priority in the position or display of the labels: dynamic position, layer priority, and priority by attribute.
Automatic labeling |
|
Automatic labeling |
Select this option to enable automatic labeling. |
Minimum scale |
Minimum scale over which automatic labeling will be activated. |
Maximum scale |
Maximum scale under which automatic labeling will be activated. |
Label position |
The position of the label in relation to the map element is determined based on a grid, with nine possible positions. This position can be fixed or dynamic. Fixed: the label is always displayed at the selected position. This is the default option. Dynamic: this function allows you to display the maximum number of labels avoiding overlapping conflicts of labels. The position of the labels of the layer varies according to the relative priority established for each position of the grid. Possible values are: 0 Blocked, 1 High, 2 Medium, and 3 Low. The default value of the center position is 1. At first JMap attempts to place the label in the center position. If this position is occupied by another label, JMap places the label in another lower priority position (Medium or Low) to minimize conflicts. |
Label offset |
Enter an offset in X and Y to modify the position of the label text. |
Layer priority |
This parameter allows you to assign the layer a priority over other layers for displaying its labels. This priority is relative, depending on the other layers that are present. The available values, from lowest to highest priority, are the following: Normal, Above Normal, High, Very High, Maximum. For example, the labels of a layer with a High priority are displayed before the labels of a layer whose priority is lower (Normal or Above Normal). |
Priority by attribute |
This parameter allows you to assign a display priority to the elements of a layer based on the value of an attribute. This priority is relative and depends on the other elements that are present in the same layer. For example, in a road network layer in which road sections are categorized according to their importance, the labels of the most important sections have a higher display priority than the labels of the less important sections. The attribute can be numeric or alphanumeric, and it must be possible to organize the values in ascending or descending order. Check this option to select the attribute to use for the prioritization in the drop-down menu. This icon is used to establish whether the priority gradient is in the ascending or descending direction of the values. |
Allow labels overlapping |
Allow the labels of one layer to overlap and to overlap the labels of other layers. This option overrides the global project setting that prevents label overlapping. This can be useful to ensure that all labels of this layer are displayed. |
Prevent label duplication |
Select this option to avoid having the same label text displayed many times. Useful for displaying street names. |
Parse numeric labels |
If label contains text and numbers, display only numeric values. Useful when you want to display only highway numbers using an attribute containing other text (e.g. "Highway 40" becomes "40"). |
Oriented labels (along the line) |
Only for line elements. Select this option to display the label text along the lines. |
Curved labels |
Only for line elements. Select this option to have the label text follow curved lines. |
Proportional size |
By default, label text is always displayed at the specified font size, independently of the scale of the map. Use this option to have the label text size adjusted proportionally to the scale of the map. The text will be displayed at its specified font size when looking at the map at the specified reference scale. When the scale of the displayed map is changed, the text size will be modified accordingly. |
Background symbol |
Select this option in order to choose a symbol that will be displayed behind the label text. Note that the label text should fit in the selected symbol. This is used mainly for highway shields containing highway numbers. |
Draw frame |
Select this option to draw a frame around the label text. You can also select the color of the background of the frame as well as the color of its border. |
Rotation |
Select this option if you want the labels to have a rotation. Angle attribute: You can select a numeric bound attribute that contains the rotation angle of the text. The labels will follow this rotation. Rotation direction: If an angle attribute is used, select the direction of the rotation. |
Follow map rotation |
Select this option to have the labels rotated with the map if the user sets a map rotation. |
Follow symbol position |
Check this option if you want the labels to follow the symbol when an offset is applied to it. |