创建逻辑示意图 (Schematics)

摘要

此工具可创建逻辑示意图。取决于逻辑示意图构建器,可基于要素图层、要素类、对象表、网络分析图层或 XML 数据创建逻辑示意图。

用法

语法

CreateDiagram_schematics (out_location, out_name, diagram_type, {in_data}, {builder_options})
参数说明数据类型
out_location

要在其中创建逻辑示意图的逻辑示意图数据集或逻辑示意图文件夹。

警告警告:

此容器必须已经存在。

Schematic dataset;Schematic folder
out_name

要创建的逻辑示意图的名称。

String
diagram_type
[diagram_type,...]

要创建的逻辑示意图的逻辑示意图模板。

in_data
(可选)

生成逻辑示意图所需的输入数据。

输入数据参数可指定生成逻辑示意图要基于的元素。对于大多数预定义的逻辑示意图构建器而言其是必选参数:

  • 对于使用配置成通过几何网络操作的“标准构建器”的逻辑示意图模板,“输入数据”必须至少引用一个要素图层、要素类或对象表。
  • 对于使用“网络数据集构建器”的逻辑示意图模板,“输入数据”参数必须引用唯一的网络分析图层。如果未执行相关网络分析,则 Schematics 会在输入求解的分析图层前尝试执行。
  • 对于与“XML 构建器”相关的逻辑示意图模板,如果逻辑示意图生成的数据具有外部组件,则“输入数据”参数可选。但是,如果未定义构建器属性的外部组件,则“输入数据”必须引用 XML 文件。在此两种情况下,输入 XML 数据必须根据 XMLBuilderDiagram XML 方案文件构建。
  • 对于使用配置成通过自定义查询操作的“标准构建器”的逻辑示意图模板,不需要输入数据。
警告警告:

对于使用“标准构建器”的逻辑示意图模板(当其配置成通过几何网络、“XML 构建器”和“网络数据集构建器”操作时),如果未指定输入数据,则不能生成逻辑示意图。

Tableview;Layer;Data element
builder_options
(可选)

逻辑示意图构建器创建参数。这些参数可选;它们仅供基于“网络数据集构建器”的逻辑示意图指定是否合并结点。其他逻辑示意图构建器不需要任何选项。

  • MERGE_NODES指定网络元素交汇点,其在生成的逻辑示意图中用单个逻辑示意图要素结点表示(沿路径分析的生成路径多次显示)。如果它们位于服务区分析的相同位置时,也可以合并中跨交汇点元素。
  • NO_MERGE_NODES指定将不合并逻辑示意图要素结点(默认)。
String

代码示例

示例 1:CreateDiagram 和处理几何网络数据的“标准构建器”

通过按几何网络形式组织的 GIS 要素创建逻辑示意图。

# Name: CreateDiagramStd.py # Description: Create schematic diagrams from GIS features organized into a geometric network # Author: ESRI  # import system modules import arcpy msgNoLicenseAvailable = "Schematics license required"  try: 	# Check out the ArcGIS Schematic extension license 	if arcpy.CheckExtension("Schematics") == "Available": 		arcpy.CheckOutExtension("Schematics") 	else: 		raise Exception(msgNoLicenseAvailable) 	 	# Set environment settings 	arcpy.OverWriteOutput = True 	arcpy.env.workspace = "C:\ArcGIS\ArcTutor\Schematics\Schematics_In_ArcMap\ElecDemo.gdb"  	#Process: CreateDiagram from the Feeder feature class: A diagram containing schematic features associated with each GIS feature stored in that feature class will be created. 	arcpy.CreateDiagram_schematics("ElecDemo", "FeederDiagram", "GeoSchematic", "ElectricNetwork\Feeder")  	#Process: CreateDiagram based on all primary lines Phase ABC 	# 1) Create a layer with the selection 	InputLayer = arcpy.MakeFeatureLayer_management(r'ElectricNetwork\PrimaryLine',"PrimaryLineLayer", "[PHASECODE] =135") 	# 2) Use the layer as input of CreateDiagram 	arcpy.CreateDiagram_schematics("ElecDemo", "ElectricMainNetworkDiagram", "GeoSchematic", InputLayer)  	# Returns the schematic license 	arcpy.CheckInExtension("Schematics")  except Exception as exc: 		print exc 
示例 2:CreateDiagram 和网络数据集构建器

通过求解的网络分析图层创建逻辑示意图。

# Name: CreateDiagramNDS.py # Description: Create schematic diagrams based on the Network Dataset builder # Author: ESRI  # import system modules import arcpy msgNoLicenseAvailable = "Schematics license required"  try: 	# Check out the ArcGIS Schematic extension license 	if arcpy.CheckExtension("Schematics") == "Available": 		arcpy.CheckOutExtension("Schematics") 	else: 		raise Exception(msgNoLicenseAvailable) 	 	# Check out the Network Analyst extension license 	if arcpy.CheckExtension("Network Analyst") == "Available": 		arcpy.CheckOutExtension("Network Analyst") 	else: 		raise Exception(msgNoLicenseNetworkAnalystAvailable)  	# Set environment settings 	arcpy.OverWriteOutput = True 	arcpy.env.workspace = "C:\ArcGIS\ArcTutor\Schematics\Schematics_Configuration\Network_Dataset\NetworkAnalyst_Schematics.gdb"  	#Solving the Route network analysis layer 	arcpy.solve("Route", "HALT")  	#Process: CreateDiagram from the solved Route network analysis layer: A diagram containing schematic features associated with each route objects in that network analysis layer will be created. Depending on the MERGE_NODES and NO_MERGE_NODES option, network element junctions which are taken several times along the resultant route will be represented by a single schematic feature node in the generated schematic diagram (MERGE_NODES) or not (NO_MERGE_NODES) 	arcpy.CreateDiagram_schematics("NA_SchematicDataset", "DiagramRoute1_MERGED", "NADiagrams", "Route", "MERGE_NODES") 	arcpy.CreateDiagram_schematics("NA_SchematicDataset", "DiagramRoute1_NOTMERGED", "NADiagrams", "Route", "NO_MERGE_NODES")			   	# Returns the schematic license 	arcpy.CheckInExtension("Schematics") 	arcpy.CheckInExtension("Network Analyst")  except Exception as exc: 		print exc
示例 3:CreateDiagram 和 XML 构建器

基于“XML 构建器”创建逻辑示意图。

# Name: CreateDiagramXML.py # Description: Create a schematic diagram based on the XML builder # Author: ESRI  # import system modules import arcpy msgNoLicenseAvailable = "Schematics license required"  try: 	# Check out the ArcGIS Schematic extension license 	if arcpy.CheckExtension("Schematics") == "Available": 		arcpy.CheckOutExtension("Schematics") 	else: 		raise Exception(msgNoLicenseAvailable) 	 	# Set environment settings 	arcpy.OverWriteOutput = True 	arcpy.env.workspace = "C:\ArcGIS\ArcTutor\Schematics\Schematics_Configuration\XML_Data\GISDatabaseForXML.gdb"  	#Process: CreateDiagram from the SampleNetworkData.xml file based on the XMLBuilderDiagram XML Schema file: A diagram containing schematic features associated with each element stored in that XML file will be created. 	arcpy.CreateDiagram_schematics("XMLSampleSchDataset", "XMLDiagramSample", "XMLDiagrams", "C:\ArcGIS\ArcTutor\Schematics\Schematics_Configuration\XML_Data\SampleNetworkFeeder1.xml")  	# Returns the schematic license 	arcpy.CheckInExtension("Schematics")  except Exception as exc: 		print exc
示例 4:CreateDiagram 和使用自定义查询的标准构建器

通过自定义查询创建逻辑示意图。

# Name: CreateDiagramCustomQuery.py # Description: Create a schematic diagram from custom queries # Author: ESRI  # import system modules import arcpy msgNoLicenseAvailable = "Schematics license required"  try: 	# Check out the ArcGIS Schematic extension license 	if arcpy.CheckExtension("Schematics") == "Available": 		arcpy.CheckOutExtension("Schematics") 	else: 		raise Exception(msgNoLicenseAvailable) 	 	# Set environment settings 	arcpy.OverWriteOutput = True 	arcpy.env.workspace = "C:\ArcGIS\ArcTutor\Schematics\Schematics_In_ArcMap\ElecDemo.gdb"  	#Process: CreateDiagram from the InsidePlants diagram template. 	arcpy.CreateDiagram_schematics("ElecDemo\Inside Plants", "Substation 08", "InsidePlants")  	# Returns the schematic license 	arcpy.CheckInExtension("Schematics")  except Exception as exc: 		print exc

环境

相关主题

许可信息

ArcView: 需要 Schematics
ArcEditor: 需要 Schematics
ArcInfo: 需要 Schematics

7/10/2012