更新逻辑示意图 (Schematics)
摘要
更新逻辑示意图。
根据逻辑示意图构建器的不同,可基于要素图层、要素类、对象表、已求解的网络分析或 XML 文件来更新逻辑示意图。
用法
-
对于使用网络数据集构建器和 XML 构建器的逻辑示意图,输入数据参数是不可或缺的。对于使用配置为根据几何网络或网络数据集进行操作的标准构建器的逻辑示意图,该参数为可选参数。对于使用配置为根据自定义查询进行操作的标准构建器的逻辑示意图,不得指定该参数。
-
当对已从几何网络追踪中生成的标准构建器所实现的逻辑示意图使用“更新逻辑示意图”工具时,更新会通过基于追踪参数(根据高亮显示的追踪首次生成逻辑示意图时,会在逻辑示意图数据集中保留该参数)的更新追踪结果进行操作。
-
当必须从组成几何网络或网络数据集的要素中执行更新过程时,不必在输入数据参数中指定所有要素图层。如果为“标准构建器”属性指定了添加连接的结点选项,则即使与该几何网络或网络数据集(交汇点和边)相关的所有要素图层都将用于更新,也只能指定与边要素或边网络元素相关的要素图层。
-
如果为指定的逻辑示意图保存了特定布局,则会根据更新前逻辑示意图中逻辑示意图要素上次保存的位置来显示这些要素,而更新期间可能引入的新逻辑示意图要素将定位在其地理坐标处。
语法
参数 | 说明 | 数据类型 |
in_diagram |
要更新的逻辑示意图图层。 | Schematic Layer |
in_data [in_data,...] (可选) |
更新逻辑示意图时所依据的输入数据。 对于所有预定义的构建器,输入数据参数并不是必需的;该参数为可选参数:
| Table View;Data Element;Layer |
builder_options [builder_options,...] (可选) |
逻辑示意图构建器更新选项。更新选项是可选的。这些选项取决于与实现指定逻辑示意图的逻辑示意图模板相关的构建器:
| String |
代码实例
更新完全通过自定义查询构建的示例逻辑示意图。这种情况下,只需要逻辑示意图名称参数。
以下 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 environment settings
arcpy.env.overwriteOutput = True
arcpy.env.workspace = "C:\ArcGIS\ArcTutor\Schematics\Schematics_In_ArcMap\ElecDemo.gdb"
# UpdateDiagram by only refreshing the attributes on schematic features contained in the input diagram; builder_options=REFRESH
arcpy.UpdateDiagram_schematics("ElecDemo\Inside Plants\Substation 08", "#", "REFRESH")
# UpdateDiagram by fully synchronizing the diagram content regarding the custom queries; no udpate parameters required
arcpy.UpdateDiagram_schematics("ElecDemo\Inside Plants\Substation 08")
# 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)
更新通过构成几何网络的要素构建的示例逻辑示意图。
以下 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 environment settings
arcpy.env.overwriteOutput = True
arcpy.env.workspace = "C:\ArcGIS\ArcTutor\Schematics\Schematics_In_ArcMap\ElecDemo.gdb"
# Creates some new diagrams that will be used to exemplify the UpdateDiagram command:
arcpy.CreateDiagram_schematics("ElecDemo", "FeederDiagram", "GeoSchematic", "ElectricNetwork\Feeder")
arcpy.CreateDiagram_schematics("ElecDemo", "FeederDiagramBIS", "GeoSchematic", "ElectricNetwork\Feeder")
arcpy.CreateDiagram_schematics("ElecDemo", "WholeElectricNetworkDiagram", "GeoSchematic", "ElectricNetwork\PrimaryLine;ElectricNetwork\SecondaryLine")
InputLayer = arcpy.MakeFeatureLayer_management("ElectricNetwork\PrimaryLine","PrimaryLineLayer", "PHASECODE =135")
arcpy.CreateDiagram_schematics("ElecDemo", "PrimaryLinesDiagram", "GeoSchematic", InputLayer)
# UpdateDiagram by fully synchronizing the diagram content regarding the original network features that were used to initially generate it; no udpate parameters required
arcpy.UpdateDiagram_schematics("ElecDemo\Feeders\Feeder 0801-Rice Creek")
# UpdateDiagram by only refreshing the attributes on schematic features contained in the input diagram; builder_options=REFRESH
arcpy.UpdateDiagram_schematics("ElecDemo\Feeders\Feeder 0802-Goldmine", "#", "REFRESH")
# UpdateDiagram by rebuilding the input diagram from a feature class; builder_options=REBUILD;KEEP_MANUAL_MODIF or REBUILD;NO_KEEP_MANUAL_MODIF
arcpy.UpdateDiagram_schematics("ElecDemo\WholeElectricNetworkDiagram", "ElectricNetwork\PrimaryLine", "REBUILD;KEEP_MANUAL_MODIF")
# UpdateDiagram by appending new features to the input diagram with a partial synchronization of the diagram content; builder_options=APPEND_QUICK;KEEP_MANUAL_MODIF or APPEND_QUICK;NO_KEEP_MANUAL_MODIF
arcpy.UpdateDiagram_schematics("ElecDemo\FeederDiagram", "ElectricNetwork\Substation", "APPEND_QUICK;KEEP_MANUAL_MODIF")
# UpdateDiagram by appending new features to the input diagram with a full synchronization of the diagram content; builder_options=APPEND;KEEP_MANUAL_MODIF or APPEND;NO_KEEP_MANUAL_MODIF
arcpy.UpdateDiagram_schematics("ElecDemo\FeederDiagramBIS", "ElectricNetwork\ServiceLocation", "APPEND;KEEP_MANUAL_MODIF")
# UpdateDiagram by rebuilding the input diagram from an input layer; builder_options=REBUILD;KEEP_MANUAL_MODIF or REBUILD;NO_KEEP_MANUAL_MODIF
arcpy.UpdateDiagram_schematics("ElecDemo\PrimaryLinesDiagram", InputLayer, "REBUILD;KEEP_MANUAL_MODIF")
# 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)
更新基于“XML 构建器”的示例逻辑示意图。
以下 Python 脚本示例的运行方法:
- 启动 ArcCatalog。
- 创建并配置示例脚本中使用的逻辑示意图数据集:
- 导航到目录树中的 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 environment settings
arcpy.env.overwriteOutput = True
arcpy.env.workspace = "C:\ArcGIS\ArcTutor\Schematics\Schematics_Configuration\XML_Data\GISDatabaseForXML.gdb"
# CreateDiagram from a XML file, SampleNetworkFeeder1.xml
arcpy.CreateDiagram_schematics("XMLDataset", "XMLDiagramFeeder1", "XMLDiagrams", "C:\ArcGIS\ArcTutor\Schematics\Schematics_Configuration\XML_Data\SampleNetworkFeeder1.xml")
# Updates the XMLDiagramFeeder1 diagram from another XML file, SampleNetworkUpdatedFeeder1.xml
arcpy.UpdateDiagram_schematics("XMLDataset\XMLDiagramFeeder1", "C:\ArcGIS\ArcTutor\Schematics\Schematics_Configuration\XML_Data\SampleNetworkUpdatedFeeder1.xml")
# 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)
更新基于“网络数据集构建器”的逻辑示意图。
此 Python 脚本示例的运行方法:
- 启动 ArcMap。
- 打开存储在 C:\ArcGIS\ArcTutor\Schematics\Schematics_Configuration\Network_Dataset 中的 ParisTours.mxd 文件。
- 单击“地理处理”>“地理处理选项”。
- 在“后台处理”部分中,取消选中“启用”,然后单击“确定”。
- 复制以下脚本并粘贴到 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 environment settings
arcpy.env.overwriteOutput = True
arcpy.env.workspace = "C:\ArcGIS\ArcTutor\Schematics\Schematics_Configuration\Network_Dataset\NetworkAnalyst_Schematics.gdb"
# UpdateDiagram from a solved route network analysis layer
# 1) Solves the route network analysis layer,
arcpy.Solve_na("Routes\Tour2")
# 2) Creates diagrams from this solved route network analysis layer
# a - DiagramTour_A diagram, created with merged nodes to represent network junctions which are crossed several times along the resultant route (MERGE_NODES option)
arcpy.CreateDiagram_schematics("NA_SchematicDataset", "DiagramTour2_A", "NADiagrams", "Routes\Tour2", "MERGE_NODES")
# b - DiagramTour_B diagram, without merged nodes (NO_MERGE_NODES option)
arcpy.CreateDiagram_schematics("NA_SchematicDataset", "DiagramTour2_B", "NADiagrams", "Routes\Tour2", "NO_MERGE_NODES")
# 3) Updates those diagrams from the same solved route network analysis layer by changing the merge nodes option
arcpy.UpdateDiagram_schematics("NA_SchematicDataset\DiagramTour2_A", "Routes\Tour2", "NO_MERGE_NODES;KEEP_MANUAL_MODIF")
arcpy.UpdateDiagram_schematics("NA_SchematicDataset\DiagramTour2_B", "Routes\Tour2", "MERGE_NODES;KEEP_MANUAL_MODIF")
# 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)