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 while 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.

Country: ev(country)

will produce

 

Country: Canada

City: ev(city) (ev(country))

Population: ev(pop)

will produce

City: Paris (France)

Population: 2150000

Labels also support javascript programming to perform mathematical operations as well as operations on character strings using attribute values. The println 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;

println(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

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.

Minimum scale

Minimum scale over which automatic labeling will be activated.

Maximum scale

Maximum scale under which automatic labeling will be activated.

Label position

Select the position of the label text with regard to the map element.

Label offset

Enter an offset in X and Y to modify the position of the label text.

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 text 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 size 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 to select a symbol to display 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

If needed, select a 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.