描述
更新逻辑示意图。
根据逻辑示意图构建器的不同,可基于要素图层、要素类、对象表、已求解的网络分析或 XML 文件来更新逻辑示意图。
使用
对于使用网络数据集构建器和 XML 构建器的逻辑示意图,输入数据参数是不可或缺的。对于使用配置为根据几何网络或网络数据集进行操作的标准构建器的逻辑示意图,该参数为可选参数。对于使用配置为根据自定义查询进行操作的标准构建器的逻辑示意图,不得指定该参数。
当对已从几何网络追踪中生成的标准构建器所实现的逻辑示意图使用“更新逻辑示意图”工具时,更新会通过基于追踪参数(根据高亮显示的追踪首次生成逻辑示意图时,会在逻辑示意图数据集中保留该参数)的更新追踪结果进行操作。
当必须从组成几何网络或网络数据集的要素中执行更新过程时,不必在输入数据参数中指定所有要素图层。如果为“标准构建器”属性指定了添加连接的结点选项,则即使与该几何网络或网络数据集(交汇点和边)相关的所有要素图层都将用于更新,也只能指定与边要素或边网络元素相关的要素图层。
如果为指定的逻辑示意图保存了特定布局,则会根据更新前逻辑示意图中逻辑示意图要素上次保存的位置来显示这些要素,而更新期间可能引入的新逻辑示意图要素将定位在其地理坐标处。
语法
UpdateDiagram(in_diagram, {in_data}, {builder_options})
参数 | 说明 | 数据类型 |
in_diagram | 要更新的逻辑示意图图层。 | Schematic Layer |
in_data [in_data,...] (可选) | 更新逻辑示意图时所依据的输入数据。 对于所有预定义的构建器,输入数据参数并不是必需的;该参数为可选参数:
| Table View;Data Element;Layer |
builder_options (可选) | 逻辑示意图构建器更新选项。更新选项是可选的。它们取决于与实现指定逻辑示意图的逻辑示意图模板相关的构建器:
| String |
代码示例
使用自定义查询的 UpdateDiagram 和标准构建器 - 示例 1(独立 Python 脚本)
更新完全通过自定义查询构建的示例逻辑示意图。这种情况下,只需要逻辑示意图名称参数。以下 Python 脚本示例的运行方法:
- 启动 ArcCatalog 或 ArcMap,显示一个新的空地图。
- 将以下脚本复制并粘贴到 Python 窗口中。
- 按 Enter 键。
# Name: UpdateDiagramCustomQuery.py
# Description: Update a schematic diagram entirely built from custom queries
# Requirement: ArcGIS Schematics 扩展模块
# import system modules
import arcpy
msgNoLicenseAvailable = "ArcGIS Schematics 扩展模块 license required"
try:
# Checks out the ArcGIS Schematics 扩展模块 license
if arcpy.CheckExtension("Schematics") == "Available":
arcpy.CheckOutExtension("Schematics")
else:
raise Exception(msgNoLicenseAvailable)
# Sets Schematics general settings
dataLocation="C:/ArcGIS/ArcTutor/Schematics/Schematics_In_ArcMap"
gdbName="ElecDemo.gdb"
in_schDataset="ElecDemo"
in_schFolder="Inside Plants"
in_diagName="Substation 08"
builder_option1="REFRESH"
# Sets environment settings
arcpy.env.overwriteOutput = True
arcpy.env.workspace = dataLocation + "/" + gdbName
# UpdateDiagram by only refreshing attributes on the input diagram's schematic features
arcpy.UpdateDiagram_schematics(in_schDataset + "/" + in_schFolder + "/" + in_diagName, "#", builder_option1)
# UpdateDiagram by fully synchronizing the input custom queries-based diagram (no parameters required)
arcpy.UpdateDiagram_schematics(in_schDataset + "/" + in_schFolder + "/" + in_diagName)
# Returns the ArcGIS Schematics 扩展模块 license
arcpy.CheckInExtension("Schematics")
print "Script completed successfully"
except Exception as e:
# If an error occurred, print line number and error message
import traceback, sys
tb = sys.exc_info()[2]
print "An error occurred on line %i" % tb.tb_lineno
print str(e)
使用几何网络数据的 UpdateDiagram 和标准构建器 - 示例 2(独立 Python 脚本)
更新通过构成几何网络的要素构建的示例逻辑示意图。以下 Python 脚本示例的运行方法:
- 启动 ArcCatalog 或 ArcMap,显示一个新的空地图。
- 将以下脚本复制并粘贴到 Python 窗口中。
- 按 Enter 键。
# Name: UpdateDiagramStd.py
# Description: Update schematic diagrams built from features organized into a geometric network
# Requirement: ArcGIS Schematics 扩展模块
# import system modules
import arcpy
msgNoLicenseAvailable = "ArcGIS Schematics 扩展模块 license required"
try:
# Checks out the ArcGIS Schematics 扩展模块 license
if arcpy.CheckExtension("Schematics") == "Available":
arcpy.CheckOutExtension("Schematics")
else:
raise Exception(msgNoLicenseAvailable)
# Sets Schematics general settings
dataLocation="C:/ArcGIS/ArcTutor/Schematics/Schematics_In_ArcMap"
gdbName="ElecDemo.gdb"
in_schDataset="ElecDemo"
in_schFolder="Feeders"
in_diagTempName="GeoSchematic"
# Sets variables used for the A/ UpdateDiagram sample
in_diagAName="Feeder 0801-Rice Creek"
# Sets variables used for the B/ UpdateDiagram sample
in_diagBName="Feeder 0802-Goldmine"
# Sets variables used for the C/ UpdateDiagram sample
in_diagCName="WholeElectricNetworkDiagram"
input_ForCDiag="ElectricNetwork/PrimaryLine;ElectricNetwork/SecondaryLine"
input_FC1="ElectricNetwork/PrimaryLine"
# Sets variables used for the D/ UpdateDiagram sample
in_diagDName="FeederDiagram"
input_ForDDiag="ElectricNetwork/Feeder"
input_FC2="ElectricNetwork/Substation"
# Sets variables used for the E/ UpdateDiagram sample
in_diagEName="FeederDiagramBIS"
input_ForEDiag="ElectricNetwork/Feeder"
input_FC3="ElectricNetwork/ServiceLocation"
# Sets variables used for the F/ UpdateDiagram sample
input_LayerName="PrimaryLineLayer"
input_Filter="PHASECODE=135"
in_diagFName="PrimaryLinesDiagram"
# Sets builder_options variables for diagram Update
# - For simply refreshing the diagram's attributes only
U_option1="REFRESH"
# - For rebuilding the diagram from a different input
U_option2="REBUILD;KEEP_MANUAL_MODIF"
U_option2BIS="REBUILD;NO_KEEP_MANUAL_MODIF"
# - For appending new features to the diagram with a partial synchronization of its content
U_option3="APPEND_QUICK;KEEP_MANUAL_MODIF"
U_option3BIS="APPEND_QUICK;NO_KEEP_MANUAL_MODIF"
# - For appending new features to the diagram with a full synchronization of its content
U_option4="APPEND;KEEP_MANUAL_MODIF"
U_option4BIS="APPEND;NO_KEEP_MANUAL_MODIF"
# Sets environment settings
arcpy.env.overwriteOutput = True
arcpy.env.workspace = dataLocation + "/" + gdbName
# Creates some new diagrams that will be used to exemplify the C/, D/, E/ and F/ UpdateDiagram samples
arcpy.CreateDiagram_schematics(in_schDataset, in_diagCName, in_diagTempName, input_ForCDiag)
arcpy.CreateDiagram_schematics(in_schDataset, in_diagDName, in_diagTempName, input_ForDDiag)
arcpy.CreateDiagram_schematics(in_schDataset, in_diagEName, in_diagTempName, input_ForEDiag)
InputLayer = arcpy.MakeFeatureLayer_management(input_FC1, input_LayerName, input_Filter)
arcpy.CreateDiagram_schematics(in_schDataset, in_diagFName, in_diagTempName, InputLayer)
# A/ UpdateDiagram by fully synchronizing the diagram content; no udpate parameters required
arcpy.UpdateDiagram_schematics(in_schDataset + "/" + in_schFolder + "/" + in_diagAName)
# B/ UpdateDiagram by only refreshing attributes on the input diagram's schematic features
arcpy.UpdateDiagram_schematics(in_schDataset + "/" + in_schFolder + "/" + in_diagBName, "#", U_option1)
# C/ UpdateDiagram by rebuilding the input diagram from a feature class
arcpy.UpdateDiagram_schematics(in_schDataset + "/" + in_diagCName, input_FC1, U_option2)
# D/ UpdateDiagram by appending new features to the input diagram with a partial synchronization
arcpy.UpdateDiagram_schematics(in_schDataset + "/" + in_diagDName, input_FC2, U_option3)
# E/ UpdateDiagram by appending new features to the input diagram with a full synchronization
arcpy.UpdateDiagram_schematics(in_schDataset + "/" + in_diagEName, input_FC3, U_option4)
# F/ UpdateDiagram by rebuilding the input diagram from an input layer
arcpy.UpdateDiagram_schematics(in_schDataset + "/" + in_diagFName, InputLayer, U_option2)
# Returns the ArcGIS Schematics 扩展模块 license
arcpy.CheckInExtension("Schematics")
print "Script completed successfully"
except Exception as e:
# If an error occurred, print line number and error message
import traceback, sys
tb = sys.exc_info()[2]
print "An error occurred on line %i" % tb.tb_lineno
print str(e)
UpdateDiagram 和 XML 构建器 - 示例 3(独立 Python 脚本)
更新基于“XML 构建器”的示例逻辑示意图。以下 Python 脚本示例的运行方法:
- 启动 ArcCatalog。
- 创建并配置示例脚本中使用的逻辑示意图数据集:
- 导航至 Catalog 树中的 C:\ArcGIS\ArcTutor\Schematics\Schematics_Configuration\XML_Data 文件夹。
- 右键单击 GISDatabaseForXML 地理数据库,指向“新建”,然后单击“逻辑示意图数据集”。
- 输入 XMLDataset 作为新建逻辑示意图数据集的名称,然后按下 ENTER。
- 右键单击 XMLDataset 逻辑示意图数据集,然后单击编辑。
- 在“数据集编辑器”树中右键单击 XMLDataset 条目,然后单击新建逻辑示意图模板。
- 在名称文本框中输入 XMLDiagrams。
- 在逻辑示意图构建器部分中选择 XML 构建器。
- 单击逻辑示意图构建器属性,然后选中自动创建逻辑示意图要素类。
- 关闭构建器属性对话框。
- 单击“确定”。
- 单击逻辑示意图数据集编辑器工具条上的“保存”,然后关闭逻辑示意图数据集编辑器。
- 将以下脚本复制并粘贴到 ArcCatalog 或 ArcMap Python 窗口中。
- 按 Enter 键。
# Name: UpdateDiagramXML.py
# Description: Update schematic diagrams based on the XML builder
# Requirement: ArcGIS Schematics 扩展模块
# import system modules
import arcpy
msgNoLicenseAvailable = "ArcGIS Schematics 扩展模块 license required"
try:
# Checks out the ArcGIS Schematics 扩展模块 license
if arcpy.CheckExtension("Schematics") == "Available":
arcpy.CheckOutExtension("Schematics")
else:
raise Exception(msgNoLicenseAvailable)
# Sets Schematics general settings
dataLocation="C:/ArcGIS/ArcTutor/Schematics/Schematics_Configuration/XML_Data"
gdbName="GISDatabaseForXML.gdb"
in_schDataset="XMLDataset"
in_diagName="XMLDiagramFeeder1"
in_diagTempName="XMLDiagrams"
input_XmlFile1="SampleNetworkFeeder1.xml"
input_XmlFile2="SampleNetworkUpdatedFeeder1.xml"
# Sets environment settings
arcpy.env.overwriteOutput = True
arcpy.env.workspace = dataLocation + "/" + gdbName
# CreateDiagram from a XML file, SampleNetworkFeeder1.xml
arcpy.CreateDiagram_schematics(in_schDataset, in_diagName, in_diagTempName, dataLocation + "/" + input_XmlFile1)
# Updates the XMLDiagramFeeder1 diagram from another XML file, SampleNetworkUpdatedFeeder1.xml
arcpy.UpdateDiagram_schematics(in_schDataset + "/" + in_diagName, dataLocation + "/" + input_XmlFile2)
# Returns the ArcGIS Schematics 扩展模块 license
arcpy.CheckInExtension("Schematics")
print "Script completed successfully"
except Exception as e:
# If an error occurred, print line number and error message import traceback, sys
tb = sys.exc_info()[2]
print "An error occured on line %i" % tb.tb_lineno
print str(e)
UpdateDiagram 和网络数据集构建器 - 示例 4(独立 Python 脚本)
更新基于“网络数据集构建器”的逻辑示意图。以下 Python 脚本示例的使用方法:
- 启动 ArcMap。
- 打开存储在 C:\ArcGIS\ArcTutor\Schematics\Schematics_Configuration\Network_Dataset 中的 ParisTours.mxd 文件。
- 单击地理处理 > 地理处理选项。
- 取消选中后台处理部分上的启用,然后单击 OK。
- 将以下脚本复制并粘贴到 Python 窗口中。
# Name: UpdateDiagramNDS.py
# Description: Update sample schematic diagrams based on the Network Dataset builder
# Requirement: ArcGIS Schematics 扩展模块,ArcGIS Network Analyst 扩展模块
# import system modules
import arcpy
msgNoLicenseSchematicsAvailable = "ArcGIS Schematics 扩展模块 license required"
msgNoLicenseNetworkAnalystAvailable = "ArcGIS Network Analyst 扩展模块 license required"
try:
# Checks out the ArcGIS Schematics 扩展模块 licence
if arcpy.CheckExtension("Schematics") == "Available":
arcpy.CheckOutExtension("Schematics")
else:
raise Exception(msgNoLicenseSchematicsAvailable)
# Checks out the ArcGIS Network Analyst 扩展模块 licence
if arcpy.CheckExtension("Network") == "Available":
arcpy.CheckOutExtension("Network")
else:
raise Exception(msgNoLicenseNetworkAnalystAvailable)
# Sets general settings
dataLocation="C:/ArcGIS/ArcTutor/Schematics/Schematics_Configuration/Network_Dataset"
gdbName="NetworkAnalyst_Schematics.gdb"
in_schDataset="NA_SchematicDataset"
in_diagAName="DiagramTour2_A"
in_diagBName="DiagramTour2_B"
in_diagTempName="NADiagrams"
in_NALayerName="Routes/Tour2"
# builder_options variables for diagram Generation and Update
G_option1="MERGE_NODES"
G_option2="NO_MERGE_NODES"
U_option1="NO_MERGE_NODES;KEEP_MANUAL_MODIF"
U_option2="MERGE_NODES;KEEP_MANUAL_MODIF"
# Sets environment settings
arcpy.env.overwriteOutput = True
arcpy.env.workspace = dataLocation + "/" + gdbName
# UpdateDiagram from a solved route network analysis layer
# 1) Solves the route network analysis layer,
arcpy.Solve_na(in_NALayerName)
# 2) Creates diagrams from this solved route network analysis layer
# a - A diagram where a single node is created to represent a GIS point crossed N times along this route (G_option1)
arcpy.CreateDiagram_schematics(in_schDataset, in_diagAName, in_diagTempName, in_NALayerName, G_option1)
# b - A diagram where N nodes are created to represent a GIS point crossed N times along this route (G_option2)
arcpy.CreateDiagram_schematics(in_schDataset, in_diagBName, in_diagTempName, in_NALayerName, G_option2)
# 3) Updates those diagrams from the same solved route network analysis layer by changing the merge nodes option
arcpy.UpdateDiagram_schematics(in_schDataset + "/" + in_diagAName, in_NALayerName, U_option1)
arcpy.UpdateDiagram_schematics(in_schDataset + "/" + in_diagBName, in_NALayerName, U_option2)
# Returns the licences
arcpy.CheckInExtension("Schematics")
arcpy.CheckInExtension("Network")
print "Script completed successfully"
except Exception as e:
# If an error occurred, print line number and error message
import traceback, sys
tb = sys.exc_info()[2]
print "An error occurred on line %i" % tb.tb_lineno
print str(e)
环境
此工具不使用任何地理处理环境。
许可信息
- Basic: 需要 Schematics
- Standard: 需要 Schematics
- Advanced: 需要 Schematics