Summary
Converts labels to annotation for a single layer or the entire map. Both standard annotation and feature-linked annotation can be created.
Usage
Labels can be converted to annotation for a single layer or the entire map. If the single layer option is chosen, the layer must be specified and it must be in the map.
Label class scale ranges are respected. When the tool generates annotation for a specific map scale, it will only convert label classes that are turned on and visible at that scale.
Note:
Label class scale ranges are set on the Labeling tab in ArcGIS Pro.
Annotation feature classes will not be overwritten if a suffix is specified that already exists. In this case, a number will be added to the annotation feature class suffix (for example, CitiesAnno, CitiesAnno_1, and so on). The complete format for naming is as follows:
<layer name> <duplicate feature class count> <anno suffix> <running number>
If you are producing annotation at a variety of reference scales, design your map for each of those scales and avoid setting a reference scale in the map. You can then convert the labels to annotation for each scale and name appropriately, for example, CitiesAnno_1000, CitiesAnno_100000.
One output of this tool is a group layer. When working in the Catalog pane, the Python window, or a stand-alone Python script, you can use the Save To Layer File tool to write the output group layer to a layer file. When using ArcGIS Pro, the tool adds the group layer to the display. The group layer that is created is temporary and will not persist after the session ends unless the project is saved.
An existing group layer will be overwritten if the same layer name is specified and you explicitly state that overwriting output is allowed.
If the Create feature-linked annotation option is not checked, the Convert labels from all layers to a single output feature class option can be used to create a single annotation feature class for the entire map.
When creating a single annotation feature class for the map, label classes with similar properties can be merged into one annotation class using the Merge similar label classes option.
Annotation that is feature-linked is associated with a specific feature in another feature class in the geodatabase. If the Create feature-linked annotation option is checked, when you create the output annotation feature class, a relationship class will be automatically generated as well.
When creating feature-linked annotation, the output workspace must be the same as that of the feature classes to which they are linked.
Some labels may not currently display on the map because there is no room. To convert these labels, check the Convert unplaced labels to unplaced annotation check box. This saves the unplaced labels in the annotation feature class, allowing you to position them later in an ArcGIS Pro edit session.
Memory and in_memory workspaces do not support feature-linked annotation.
Syntax
ConvertLabelsToAnnotation(input_map, conversion_scale, output_geodatabase, {anno_suffix}, {extent}, {generate_unplaced}, {require_symbol_id}, {feature_linked}, {auto_create}, {update_on_shape_change}, {output_group_layer}, {which_layers}, {single_layer}, {multiple_feature_classes}, {merge_label_classes})
Parameter | Explanation | Data Type |
input_map | The input map. | Map |
conversion_scale | The scale at which to convert labels. If a reference scale is set on the map, the reference scale will be used for symbol sizing and annotation feature class creation, but conversion will happen at this scale. | Double |
output_geodatabase | The workspace where the output feature classes will be saved. The workspace can be an existing geodatabase or an existing feature dataset. If this is not the same database used by all the layers in the map, the feature-linked option will be disabled. | Workspace; Feature Dataset |
anno_suffix (Optional) | The suffix that will be added to each new annotation feature class. This suffix will be appended to the name of the source feature class for each new annotation feature class. | String |
extent (Optional) | Specifies the extent that contains the labels to convert to annotation. It can be the extent of the map, union of input layers, intersection of input layers, current display extent, same as specified layer extent, or it can be specified by value.
| Extent |
generate_unplaced (Optional) | Specifies whether unplaced annotation will be created from unplaced labels.
| Boolean |
require_symbol_id (Optional) | Specifies whether to restrict the text symbol properties that can be edited.
| Boolean |
feature_linked (Optional) | License:This parameter is only available with ArcGIS Desktop Standard and ArcGIS Desktop Advanced licenses. Specifies whether the output annotation feature class will be linked to the features in another feature class.
| Boolean |
auto_create (Optional) | Specifies whether annotation will be created when new features are added to the linked feature class if the feature_linked parameter is set to FEATURE_LINKED.
| Boolean |
update_on_shape_change (Optional) | Specifies whether the position of annotation will be updated when the shape of the linked feature is updated if the feature_linked parameter is set to FEATURE_LINKED.
| Boolean |
output_group_layer (Optional) | The group layer that will contain the generated annotation. You can use the Save To Layer File tool to write the output group layer to a layer file. | Group Layer |
which_layers (Optional) | Specifies whether to convert annotation for all layers in the map or for a single layer. The single layer must be specified.
| String |
single_layer (Optional) | The layer with the annotation to convert when the which_layers parameter is set to SINGLE_LAYER. This layer must be in the map. | Feature Layer |
multiple_feature_classes (Optional) | Specifies whether labels will be converted to individual annotation feature classes or to a single annotation feature class. If converting to a single annotation feature class, the annotation cannot be feature-linked.
| Boolean |
merge_label_classes (Optional) | Specifies whether similar label classes will be merged when the multiple_feature_classes parameter is set to SINGLE_FEATURE_CLASS.
| Boolean |
Derived Output
Name | Explanation | Data Type |
updated_geodatabase | The workspace where the output feature classes will be saved. | Workspace |
Code sample
Python sample for ConvertLabelsToAnnotation that converts labels to annotation for a single layer in the map.
import arcpy
arcpy.cartography.ConvertLabelsToAnnotation(
'Map1', 10000, 'D:/data/Cobourg.gdb', 'Anno', 'MAXOF', 'ONLY_PLACED',
'REQUIRE_ID', 'STANDARD', '', '', 'AnnoLayer', 'SINGLE_LAYER', 'Schools', '', '')
Stand-alone script that converts labels to annotation for the map using the ConvertLabelsToAnnotation function. The annotation will be converted to a single annotation feature class and similar label classes will be merged.
# Name: ConvertLabelsToAnnotation.py
# Description: Find all the maps in the project and
# convert labels to annotation for each map
# import system modules
import arcpy
# Loop through the project, find all the maps, and
# convert labels to annotation for each map,
# using the name of the map as part of the annotation suffix
project = arcpy.mp.ArcGISProject("D:\\data\\myproject.aprx")
for mp in project.listMaps():
print("Converting labels to annotation for: " + mp.name)
arcpy.cartography.ConvertLabelsToAnnotation(
mp, 10000, 'D:/data/Cobourg.gdb', 'Anno_' + mp.name, 'MAXOF',
'ONLY_PLACED', 'REQUIRE_ID', 'STANDARD', '', '',
'AnnoLayers_' + mp.name, 'ALL_LAYERS', '', 'SINGLE_FEATURE_CLASS',
'MERGE_LABEL_CLASS')
Environments
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes