Populate Map Sheet Info (Defense Mapping)

ライセンス レベル:BasicStandardAdvanced

サマリ

Populates text in defense-specific 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 bracketed ([]) text. It compares bracketed text to values in a list. 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 bracketed text strings. The table contains the Field_Name and Element_Part fields which control the mapping between feature attributes and graphic elements. For example, the table maps the Sheet_Name attribute to the [SHEET NAME] text. Custom Field_Name and Element_Part attributes 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 <install path>\ESRIDefenseMapping\Desktop\ReferenceData.

使用法

構文

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 bracketed text strings in defense-specific graphic elements.

Feature Layer
in_table

An input table that contains the Field_Name and Element_Part fields.

Table View

コードのサンプル

PopulateMapSheetInfo example (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 for Desktop Basic: ×
ArcGIS for Desktop Standard: 次のものが必要 Defense Mapping
ArcGIS for Desktop Advanced: 次のものが必要 Defense Mapping
4/26/2014