ArcGIS Desktop

  • 文档
  • 支持

  • My Profile
  • 帮助
  • Sign Out
ArcGIS Desktop

ArcGIS Online

专为贵组织打造的制图平台

ArcGIS Desktop

全面的专业性 GIS

ArcGIS Enterprise

面向企业的 GIS

ArcGIS for Developers

用于构建位置感知应用程序的工具

ArcGIS Solutions

适用于行业的免费模板地图和应用程序

ArcGIS Marketplace

获取适用于组织的应用程序和数据

  • 文档
  • 支持
Esri
  • 登录
user
  • 我的个人资料
  • 登出

Help

  • 主页
  • 入门
  • 制图
  • 分析
  • 管理数据
  • 工具
  • 更多...

Populate Map Sheet Info

  • 摘要
  • 用法
  • 语法
  • 代码示例
  • 环境
  • 许可信息

摘要

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. 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 may be added to the table to allow for use of new feature attributes and associated graphic elements. The PopMapInfo table is located within the MapIndex database stored in <installation path>\ArcGIS\ESRIDefenseMapping\Desktop10.3.1\ReferenceData.

注:

Esri 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.

用法

  • Input MXD must have a layout that contains graphic elements. This tool only updates tagged text strings within 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 against the active MXD, set the map display to layout view.

  • This tool updates all duplicate tagged text strings. For example, a layout can have multiple text elements with the SHEET tag (<SHEET>text</SHEET>).

  • Input Feature Layer represents an area of interest (AOI) feature. This parameter accepts only polygon features. Using other geometry types will return error 000366: Invalid geometry type.

  • Input Feature Layer must contain exactly one selected feature. This tool will return an error if the layer has 0 or more than 1 selected features.

  • Input Table defaults to the PopMapInfo table within the MapIndex database stored in <installation path>\ArcGIS\ESRIDefenseMapping\Desktop10.3.1\ReferenceData. 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.

语法

PopulateMapSheetInfo_defense (mxd, in_features, in_table)
参数说明数据类型
mxd

The path to the .mxd to update. To update the active, currently loaded map document, use the CURRENT keyword. When using the active MXD, 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 1 (Python window)

The following Python window demonstrates how to use the PopulateMapSheetInfo tool using the CURRENT keyword.

# set gp env
arcpy.env.addOutputsToMap=True
arcpy.env.workspace="c:/data/defense.mdb"

# variables for tools
tlm50="TLM50"
tlm50Lyr="TLM50"
table="PopMapInfo"
selection="NEW_SELECTION"
where="Sheet_name='San Diego'"

# make a feature layer and select a feature
arcpy.MakeFeatureLayer_management(tlm50,tlm50Lyr)
arcpy.SelectLayerByAttribute_management(tlm50Lyr,selection,where)

# get describe object from this feature layer
desc = arcpy.Describe(tlm50Lyr)

# check the FIDSet property (number of selected features) of the describe object
numselected = len(desc.FIDSet)

# exec PopulateMapSheetInfo only if there's a single selected feature
if numselected == 1:
    arcpy.PopulateMapSheetInfo_defense('CURRENT',tlm50Lyr,table)
else:
    arcpy.AddError("PopulateMapSheetInfo requires 1 selected feature")
PopulateMapSheetInfo example 2 (stand-alone script)

The following stand-alone script demonstrates how to use the PopulateMapSheetInfo tool using a path to a map document.

# Name: PopulateMapSheetInfo_Example.py
# Description: Populates text in specific defense graphic elements in a layout.
# Requirements: Defense Mapping extension

import arcpy

# check out a defense license    
arcpy.CheckOutExtension('defense')
arcpy.env.workspace="c:/data/defense.mdb"

try:
    tlm50="TLM50"
    tlm50Lyr="TLM50"
    table="PopMapInfo"
    selection="NEW_SELECTION"
    where="Sheet_name='San Diego'"
    mxd="C:/DATA/TLM50.mxd"
	
    # make a feature layer for the in_features parameter
    # change this path to match your own data
    arcpy.MakeFeatureLayer_management(tlm50,tlm50Lyr)

    # select a feature
    arcpy.SelectLayerByAttribute_management(tlm50Lyr,selection,where)

    # get describe object from this feature layer
    desc = arcpy.Describe(tlm50Lyr)

    # check the FIDSet property (number of selected features) of the describe object
    numselected = len(desc.FIDSet)

    # exec PopulateMapSheetInfo only if there's a single selected feature
    if numselected == 1:
        # change the path to the mxd to match your data
        arcpy.PopulateMapSheetInfo_defense(mxd,tlm50Lyr,table)
    else:
        arcpy.AddError("PopulateMapSheetInfo requires 1 selected feature")

    # print all the messages from this script
    print arcpy.GetMessages()

except Exception as e:
    print e.message


# check in the extension
arcpy.CheckInExtension('defense')

环境

  • 当前工作空间

许可信息

  • ArcGIS Desktop Basic: 否
  • ArcGIS Desktop Standard: 需要 Defense Mapping
  • ArcGIS Desktop Advanced: 需要 Defense Mapping

相关主题

  • An overview of the Map Document toolset

ArcGIS Desktop

  • 主页
  • 文档
  • 支持

ArcGIS 平台

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

关于 Esri

  • 关于我们
  • 招贤纳士
  • 内部人员博客
  • 用户大会
  • 开发者峰会
Esri
分享您的想法。
Copyright © 2017 Esri. | 隐私政策 | 法律声明