Summary
Converts labels to annotation for layers in a map based on a polygon index layer.
The tool divides a map into tiles and creates annotation for each tile in turn. This is useful for converting a large number of labels to annotation. The polygon index layer can be generated using the Map Server Cache Tiling Scheme To Polygons or Grid Index Features tool or any other polygon feature class that covers the area where you want to create annotation.
Usage
Label class scale ranges are respected. When the tool generates annotation for a specific reference scale, it will only convert label classes that are turned on and visible at that scale.
If you select tiles prior to running the tool, annotation will only be created for the selected tiles.
To update annotation for only some tiles in the polygon index layer, first select the annotation features with that specific TileID value and delete them. Then select the polygon features and run the tool again.
One output of this tool is a series of group layers. One group layer will contain a group layer for each reference scale for which annotation was created.
When working in ArcCatalog or ModelBuilder, you can use the Save To Layer File tool to write the output group layer to a layer file. When using ArcMap, the tool adds the group layer to the display if this option is checked in the geoprocessing options. The group layer that is created is temporary and will not persist after the session ends unless the document is saved.
Group layers created in ArcCatalog cannot be used in ArcMap unless they are saved to a layer file using the Save To Layer File tool.
An existing group layer will be overwritten if the same layer name is specified and if you explicitly state that overwriting outputs is allowed.
If duplicate feature class names are found in the data frame, a number will be added to the annotation following the feature class name (for example, Cities01Anno10000, Cities02Anno10000, and so on).
Annotation feature classes will not be overwritten if an existing suffix is specified. In this case, a number will be added to the annotation feature class suffix (for example, CitiesAnno10000, CitiesAnno10000_1, and so on).
The reference scale for the annotation feature classes can be specified in one of the following two ways:
- The first option is to use a field from the polygon index layer to determine the reference scale of the output annotation feature classes. Use this option if you will create annotation for a variety of scale levels.
- The second option is to explicitly state a reference scale value. All annotation feature classes will use this reference scale. If a reference scale is set in the map document, this will be the default value input to the tool. When using ArcMap, if no reference scale is set, the current scale will provide the default value.
If you are using a polygon index layer that was created by the Map Server Cache Tiling Scheme To Polygons tool, use the Tile_Scale field for the Reference Scale Field parameter. An annotation feature class will be created for each layer-Tile_Scale combination.
If you are producing annotation at a variety of reference scales, design the map for each of those scales and avoid setting a reference scale.
If a coordinate system field from the polygon index layer is provided, the annotation for each tile will be projected into that coordinate system for the purpose of drawing and placement.
Annotation that is feature linked is associated with a specific feature in another feature class in the geodatabase. When you create the feature-linked 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 for them. To convert these labels, check the Generate Unplaced Annotation check box. This saves the unplaced labels in the annotation feature class, allowing you to position them later in an edit session.
Syntax
arcpy.cartography.TiledLabelsToAnnotation(map_document, data_frame, polygon_index_layer, out_geodatabase, out_layer, anno_suffix, {reference_scale_value}, {reference_scale_field}, {tile_id_field}, {coordinate_sys_field}, {map_rotation_field}, {feature_linked}, {generate_unplaced_annotation})
Parameter | Explanation | Data Type |
map_document | The source map document that contains the labels to convert to annotation. | ArcMap Document |
data_frame | The data frame from the map document that contains the labels to convert to annotation. | String |
polygon_index_layer | The polygon layer that contains tile features. | Table View |
out_geodatabase | The workspace where the output feature classes will be saved. The workspace can be an existing geodatabase or an existing feature dataset. | Workspace; Feature Dataset |
out_layer | The group layer that will contain the generated annotation. When working in ArcCatalog, you can use the Save To Layer File tool to write the output group layer to a layer file. When using ArcMap, the tool adds the group layer to the display if this option is checked in the geoprocessing options. The group layer that is created is temporary and will not persist after the session ends unless the document is saved. | Group Layer |
anno_suffix | 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. The reference scale for the annotation will follow this suffix. | String |
reference_scale_value (Optional) | The scale value that will be used as a reference for the annotation. This is the scale on which all symbol and text sizes in the annotation will be based. | Double |
reference_scale_field (Optional) | The field in the polygon index layer that will determine the reference scale of the annotation. This is the scale on which all symbol and text sizes in the annotation will be based. | Field |
tile_id_field (Optional) | A field in the polygon index layer that uniquely identifies the tiled area. These values will populate the TileID field in the annotation feature class attribute table. | Field |
coordinate_sys_field (Optional) | A field in the polygon index layer that contains the coordinate system information for each tile. Due to the length required for a field to store coordinate system information, a polygon index layer that contains a coordinate system field must be a geodatabase feature class. | Field |
map_rotation_field (Optional) | A field in the polygon index layer that contains the angle by which the data frame will be rotated. | Field |
feature_linked (Optional) | Specifies whether the output annotation feature class will be linked to the features in another feature class.
| Boolean |
generate_unplaced_annotation (Optional) | Specifies whether unplaced annotation will be created from unplaced labels.
| Boolean |
Derived Output
Name | Explanation | Data Type |
out_workspace | The workspace where the output feature classes will be saved. | Workspace; Feature Dataset |
Code sample
TiledLabelsToAnnotation example (Python window)
Python sample for the TiledLabelsToAnnotation function that converts labels to annotation for layers in a map document based on a polygon index layer.
import arcpy
arcpy.env.workspace = "C:/data/data.gdb"
arcpy.TiledLabelsToAnnotation_cartography("Annotation.mxd", "Layers",
"data.gdb", "GroupAnno", "Anno", "",
"Tile_Scale", "OID", "", "",
"FEATURE_LINKED",
"GENERATE_UNPLACED_ANNOTATION")
TiledLabelsToAnnotation example 2 (workflow script)
The following script demonstrates a workflow using the MapServerCacheTilingSchemeToPolygons and TiledLabelsToAnnotation functions.
# Name: TiledLabelsToAnnotation_Example2.py
# Description: Create a tile feature class and use those tiles to create annotation.
# Requirements: ArcGIS Desktop Advanced license
# Import system modules
import arcpy
import os
# Set environment settings
arcpy.env.workspace = "C:/data/data.gdb"
# Set local variables
inMapDocument = "C:/data/Annotation.mxd"
inDataFrame = "Layers"
inTilingScheme = os.path.join(
arcpy.GetInstallInfo()['InstallDir'],
"TilingSchemes\\ArcGIS_Online_Bing_Maps_Google_Maps.xml")
outFeatureClass = "C:/data/data.gdb/Tiles"
inTileExtent = "USE_MAP_EXTENT"
inClipping = "CLIP_TO_HORIZON"
inAntialiasing = "NONE"
inScales = ""
# Execute MapServerCacheTilingSchemeToPolygons
arcpy.MapServerCacheTilingSchemeToPolygons_cartography(
inMapDocument, inDataFrame, inTilingScheme, outFeatureClass, inTileExtent,
inClipping, inAntialiasing, inScales)
# Set local variables
inMapDocument = "C:/data/Annotation.mxd"
inDataFrame = "Layers"
inPolygonIndexLayer = "Tiles"
inOutGeodatabase = "C:/data/data.gdb"
outOutLayer = "GroupAnno"
inAnnoSuffix = "Anno"
inRefScaleValue = ""
inRefScaleField = "Tile_Scale"
inTileIDField = "OID"
inCoordSysField = ""
inMapRotationField = ""
inFeatureLinked = "STANDARD"
inGenerateUnplaced = "GENERATE_UNPLACED_ANNOTATION"
# Execute TiledLabelsToAnnotation
arcpy.TiledLabelsToAnnotation_cartography(
inMapDocument, inDataFrame, inPolygonIndexLayer, inOutGeodatabase,
outOutLayer, inAnnoSuffix, inRefScaleValue, inRefScaleField, inTileIDField,
inCoordSysField, inMapRotationField,inFeatureLinked, inGenerateUnplaced)
Environments
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes