描述
Populates text in graphic elements on an ArcMap layout.
Text is populated with feature attribute values from a selected area of interest (AOI) feature in the map. The tool searches each graphic element for tagged (<tag></tag>) text. It compares tagged text to values in the PopMapInfo table. Matching values are replaced in the graphic element with an attribute value from the selected AOI feature.
使用方法
The PopMapInfo table, similar to a lookup table, maintains the relationship between feature attributes and tagged text strings. The table contains the Field_Name and DM_Tag fields, which control the mapping between feature attributes and graphic elements. For example, the table maps the Sheet attribute to text with the SHEET tag (<dm021>text</dm021>). All text in the tag will be updated, and you can run the tool as needed when feature attributes are updated. Custom Field_Name and DM_Tag fields may be added to the table to allow for use of new feature attributes and associated graphic elements. The PopMapInfo table is located in the MapIndex database stored in <installation path>\ArcGIS\ESRIDefenseMapping\Desktop<version>\ReferenceData.
The Input MXD parameter value must have a layout that contains graphic elements. The tool only updates tagged text strings in those graphic elements. Tagged text strings must follow the formats listed under DM_Tag in the Feature attribute to graphic text mapping information document.
When running this tool using the active map document, set the map display to layout view.
The tool updates all duplicate tagged text strings. For example, a layout can have multiple text elements with the SHEET tag (<SHEET>text</SHEET>).
The Input Feature Layer parameter value must contain exactly one selected feature. The tool will return an error if the layer has zero, or more than one, selected features.
The Input Table parameter value default is the PopMapInfo table in the MapIndex database stored in <installation path>\ArcGIS\ESRIDefenseMapping\Desktop<version>\ReferenceData. The Input Table value must contain the Field_Name and DM_Tag fields, which control the mapping between feature attributes and graphic elements.
Messages returned during tool execution include a list of replaced text.
语法
arcpy.defense.PopulateMapSheetInfo(mxd, in_features, in_table)
参数 | 说明 | 数据类型 |
mxd | The path to the .mxd file to update. To update the active, currently loaded map document, use the CURRENT keyword. When using the active map document, the tool must be run from the layout view. | File |
in_features | A feature layer with a selection set containing one AOI feature. The tool writes attribute values from this feature to tagged text strings in defense-specific graphic elements. | Feature Layer |
in_table | An input table that contains the Field_Name and DM_Tag fields. | Table View |
代码示例
PopulateMapSheetInfo example (stand-alone script)
The following stand-alone script demonstrates how to use the PopulateMapSheetInfo function using a path to a map document.
# Importing arcpy module
import arcpy
# Checking out Defense extension
arcpy.CheckOutExtension('defense')
# Setting variables for necessary data
map_document = r'C:\Data\Output\V795X16573.mxd'
area_of_interest = r'C:\DefenseProductFiles\ReferenceData\MapIndex.gdb\MapIndex\TLM50_Index'
map_info_table = r'C:\DefenseProductFiles\ReferenceData\MapIndex.gdb\PopMapInfo'
# Creating AOI feature layer
selection_query = "NRN = 'V795X16573'"
arcpy.management.MakeFeatureLayer(area_of_interest, 'AOI')
arcpy.management.SelectLayerByAttribute('AOI', 'NEW_SELECTION', selection_query)
# Calling Populate Map Sheet Info tool
arcpy.defense.PopulateMapSheetInfo(map_document, 'AOI', map_info_table)
# Checking in Defense extension
arcpy.CheckInExtension('defense')
环境
许可信息
- Basic: 否
- Standard: 需要 Defense Mapping
- Advanced: 需要 Defense Mapping