Resumen
Populates text in graphic elements on a map 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. Any 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 within the tag will be updated; therefore, the tool can be run as needed when feature attributes are updated. Custom Field_Name and DM_Tag fields can be added to the table to allow for use of new feature attributes and associated graphic elements.
Nota:
Defense Mapping map templates often use graphic elements with bracketed ([ ]) text to indicate text that should be updated to meet the product specification. However, brackets are not required by the Populate Map Sheet Info tool.
Uso
The input layout must contain graphic elements. This tool only updates tagged text strings in those graphic elements. Tagged text strings must follow the formats listed under the DM_Tag in Feature attribute to graphic text mapping information.
This tool updates all duplicate tagged text strings. For example, a layout can have multiple text elements with the SHEET tag (<SHEET>text</SHEET>).
The Area of Interest parameter only accepts a polygon feature layer with exactly one selected feature. This tool will return an error if the layer has more than or less than one selected feature.
The input table contains 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.
Sintaxis
arcpy.topographic.PopulateMapSheetInfo(in_layout, area_of_interest, lookup_table)
Parámetro | Explicación | Tipo de datos |
in_layout | The input layout that contains graphic elements with tagged text strings to be updated. | Layout |
area_of_interest | A feature layer with a selection set containing one AOI feature. This parameter only accepts only polygon features. The tool writes attribute values from this feature to tagged text strings in defense-specific graphic elements. | Feature Layer |
lookup_table | An input table that contains the Field_Name and DM_Tag fields. | Table View |
Salida derivada
Nombre | Explicación | Tipo de datos |
updated_layout | Output map where map information was updated. | Layout |
Muestra de código
This Python stand-alone sample replaces tagged text in the layout with attributes from the AOI feature.
# Name: PopulateMapSheetInfo_sample.py
# Description: Replaces tagged text in the layout with attributes from the AOI feature
# Import System Modules
import arcpy
# Check Out Extensions
arcpy.CheckOutExtension('Foundation')
# Setting the environment
arcpy.env.overwriteOutput = True
# Setting Local Variables
in_layout = r'C:\Data\PopMapSheetInfo_Layout.pagx'
area_of_interest = r'C:\Data\MapIndex.gdb\MapIndex\TLM50_Index'
lookup_table = r'C:\Data\MapIndex.gdb\PopMapInfo'
# Making a feature layer from the Area of Interest features, and selecting a single feature based on the NRN field
arcpy.management.MakeFeatureLayer(area_of_interest, 'AOI_Index')
arcpy.management.SelectLayerByAttribute('AOI_Index', 'NEW_SELECTION', "NRN = 'V795X16574'")
# Calling the Populate Map Sheet info tool to add values to the dynamic text elements in the layout
arcpy.topographic.PopulateMapSheetInfo(in_layout, 'AOI_Index', lookup_table)
# Getting all messages, warnings, and errors from the tool run and printing the results back to the user
messages = arcpy.GetMessages(0)
warnings = arcpy.GetMessages(1)
errors = arcpy.GetMessages(2)
arcpy.AddMessage('Tool Messages: {}\nTool Warnings: {}\nTool Errors{}\n'.format(messages, warnings, errors))
# Check In Extensions
arcpy.CheckInExtension('Foundation')
Entornos
Información de licenciamiento
- Basic: No
- Standard: Requiere Production Mapping
- Advanced: Requiere Production Mapping