操作方法

如何:在 ArcGIS Pro 中使用 Arcade 创建带有串连文本的多行标注

Last Published: July 21, 2023

摘要

In ArcGIS Pro, multiline labels with concatenated text (string) can be created using the Arcade label expression. In this article's example, the Schools layer contains information on schools in Florida such as city, ZIP Code, and type of the school, as shown in the attribute table below.

The attribute table containing the City, ZIP Code, and Type fields of the Schools layer.

This article describes the steps to create multiline labels displaying the CITY, ZIPCODE, and TYPE field values using the TextFormatting.NewLine constant and concatenate a text preceding each field value.

Note:
The TextFormatting.NewLine constant inserts a line break between the labels.

过程

  1. In an ArcGIS Pro project, add the layer, and create the label expression. For instructions, refer to Steps 1 through 4 in ArcGIS Pro: Writing a label expression, and select Arcade for Language.
  2. Build the expression in the Expression box.
    1. In the Expression box, highlight the content, and press Delete to clear the box.
    2. Type 'City:' + as the preceding text before the CITY field values.
    3. Under Fields, double-click the CITY field to add to the expression.
    4. Type + TextFormatting.NewLine to add a line break.
    5. Type + 'ZIP Code:' +.
    6. Under Fields, double-click the ZIPCODE field.
    7. Type + TextFormatting.NewLine to add another line break.
    8. Type + 'Type:' +.
    9. Under Fields, double-click the TYPE field.
    10. Click the Verify button to validate the expression. Click Apply to run the script.
The expressions are written to create multiline labels with concatenated text preceding each field value.

The following is the expression used in this article's example.

'City:' + $feature.CITY + TextFormatting.NewLine + 'ZIP Code:' + $feature.ZIPCODE + TextFormatting.NewLine + 'Type:'+$feature.TYPE

The map below displays the distribution of schools in Florida, labeled with their respective city name, ZIP Code, and school type on separate lines.

The map displays the distribution of schools in Florida labeled with their respective city name, ZIP Code, and school type.

文章 ID: 000026373

接收通知并查找新问题或常见问题的解决方案

从我们全新的 AI 聊天机器人中获得简明答案和视频解决方案。

下载 Esri 支持应用程序

获取来自 ArcGIS 专家的帮助

联系技术支持部门

下载 Esri 支持应用程序

转至下载选项