UtilityNetwork
汇总
可通过 UtilityNetwork 类访问多种支持管理子网控制器和网络要素间关联的方法。
语法
UtilityNetwork(utilityNetworkPath)
| 名称 | 说明 | 数据类型 |
|---|---|---|
|
utilityNetworkPath |
The input utility network. |
String |
方法
AddConnectivityAssociation(association_type, from_table, from_global_id, from_terminal_name, to_table, to_global_id, to_terminal_name, percent_along)
AddConnectivityAssociation 方法可在两个非重合要素之间创建 连通性关联 以模拟连通性。
例如,如果存在支持关联的网络规则,则可以在域网络中定义点要素类和交汇点对象表的连通性关联。
连通性关联有多种类型:交汇点-交汇点连通性、交汇点-边自连通性、交汇点-边中跨连通性以及交汇点-边至连通性。
| 名称 | 说明 | 数据类型 |
|---|---|---|
|
association_type |
An integer value representing the type of connectivity association that will be created.
|
Integer |
|
from_table |
The table name of the from object. |
String |
|
from_global_id |
The global ID of the from object. |
String |
|
from_terminal_name |
The terminal name of the from object. |
String |
|
to_table |
The table name of the to object. |
String |
|
to_global_id |
The global ID of the to object. |
String |
|
to_terminal_name |
The terminal name of the to object. |
String |
|
percent_along |
The percentage along the edge where the connection occurs. This is only used for midspan connectivity.. |
Float |
返回值
| 数据类型 | 说明 |
|---|---|
|
Integer |
新连通性关联的对象 ID。 |
import arcpy
editor = arcpy.da.Editor(r"C:\testData\SDK_UtilityNetwork.geodatabase")
# Pass in the utility network layer
myUtilityNetwork = arcpy.un.UtilityNetwork(
r"C:\testData\SDK_UtilityNetwork.geodatabase\main.TestNetwork\main.TestNetwork")
if not editor.isEditing:
editor.startEditing()
editor.startOperation()
object_id = myUtilityNetwork.AddConnectivityAssociation(
1, "WaterDevice","{41D5BFC0-BFED-40A1-AB1A-02B0D69FB835}",
"High Pressure In", "WaterDevice",
"{D8F5535D-36B1-485E-97D3-E92E453CC11E}", "Port One", 0)
if editor.isEditing:
editor.stopOperation()
editor.stopEditing(True)
AddContainmentAssociation(container_table, container_global_id, content_table, content_global_id, is_content_visible)
AddContainmentAssociation 方法可创建 包含关联 以对网络中密集的要素集合进行建模。
包含关联允许单个要素表示要素集合。 例如,设备、电线和导体将放置于变电站、开关装置、沟渠和管道等要素中。 可以在地图视图中显示或隐藏内容要素,以提高可见性并减少地图混乱。 包含其他要素的要素称为容器,而包含于其他要素中的要素称为内容。
公共设施网络支持嵌套包含以及内容和容器间的一对多关系。 在嵌套包含中,容器要素可以包含另一个容器要素,而其中可以包含其他内容。 例如,变电站可以包含接线盒,而接线盒可以包含电子设备。 在一对多关系中,单个内容要素可以包含在多个容器中,例如,跨越多个管线组的单个地下线路。
注:
一个点要素不能是多个容器要素的内容。
| 名称 | 说明 | 数据类型 |
|---|---|---|
|
container_table |
The table name of the container object. |
String |
|
container_global_id |
The global ID of the container object. |
String |
|
content_table |
The table name of the content object. |
String |
|
content_global_id |
The global ID of the content object. |
String |
|
is_content_visible |
Specifies whether the content will be visible. |
Boolean |
import arcpy
editor = arcpy.da.Editor(r"C:\testData\SDK_UtilityNetwork.geodatabase")
# Pass in the utility network layer
myUtilityNetwork = arcpy.un.UtilityNetwork(
r"C:\testData\SDK_UtilityNetwork.geodatabase\main.TestNetwork\main.TestNetwork")
if not editor.isEditing:
editor.startEditing()
editor.startOperation()
myUtilityNetwork.AddContainmentAssociation(
"StructureBoundary", "{A498A20B-C086-48C9-993D-F71231037806}",
"WaterDevice", "{90483407-0BBF-48FF-A7B8-D3D26313A7CB}", True)
if editor.isEditing:
editor.stopOperation()
editor.stopEditing(True)
AddStructuralAttachmentAssociation(structure_table, structure_global_id, attachment_table, attachment_global_id)
AddStructuralAttachmentAssociation 方法可创建 结构附件关联 ,以支持对网络中传递资源的支持结构和附件进行建模。
结构附件在逻辑上将结构要素与公共设施网络中的其他要素相关联。 这些关联允许您对支持设备的结构和附加于其上的关联资产之间的关系进行建模。 例如,电线杆可以作为结构,变压器可以作为附件。
| 名称 | 说明 | 数据类型 |
|---|---|---|
|
structure_table |
The table name of the structure object. |
String |
|
structure_global_id |
The global ID of the structure object. |
String |
|
attachment_table |
The table name of the attachment object. |
String |
|
attachment_global_id |
The global ID of the attachment object. |
String |
返回值
| 数据类型 | 说明 |
|---|---|
|
Integer |
新附件关联的对象 ID。 |
import arcpy
editor = arcpy.da.Editor(r"C:\testData\SDK_UtilityNetwork.geodatabase")
myUtilityNetwork = arcpy.un.UtilityNetwork(
r"C:\testData\SDK_UtilityNetwork.geodatabase\main.TestNetwork\main.TestNetwork")
if not editor.isEditing:
editor.startEditing()
editor.startOperation()
object_id = myUtilityNetwork.AddStructuralAttachmentAssociation(
"StructureJunction", "{529DE843-659D-499B-AF2A-FA8E47E89CAD}",
"ElecDistDevice", "{505C79BC-1019-4A71-85B5-F4D38F6E0C6E}")
if editor.isEditing:
editor.stopOperation()
editor.stopEditing(True)
DeleteConnectivityAssociation(association_type, association_global_id)
DeleteConnectivityAssociation 方法可移除两个要素之间的 连通性关联 。
| 名称 | 说明 | 数据类型 |
|---|---|---|
|
association_type |
An integer value representing the type of connectivity association that will be deleted.
|
Integer |
|
association_global_id |
The global ID of the association that will be deleted. |
String |
import arcpy
editor = arcpy.da.Editor(r"C:\testData\SDK_UtilityNetwork.geodatabase")
myUtilityNetwork = arcpy.un.UtilityNetwork(
r"C:\testData\SDK_UtilityNetwork.geodatabase\main.TestNetwork\main.TestNetwork")
if not editor.isEditing:
editor.startEditing()
editor.startOperation()
myUtilityNetwork.DeleteConnectivityAssociation(
1, "{0356CDD1-C44A-4273-8EE7-73A27EFEF116}")
if editor.isEditing:
editor.stopOperation()
editor.stopEditing(True)
DeleteContainmentAssociation(association_global_id)
DeleteContainmentAssociation 方法可移除容器要素及其内容之间的 容器关联 。
| 名称 | 说明 | 数据类型 |
|---|---|---|
|
association_global_id |
The global ID for the specified containment association in the utility network. |
String |
import arcpy
editor = arcpy.da.Editor(r"C:\testData\SDK_UtilityNetwork.geodatabase")
myUtilityNetwork = arcpy.un.UtilityNetwork(
r"C:\testData\SDK_UtilityNetwork.geodatabase\main.TestNetwork\main.TestNetwork")
if not editor.isEditing:
editor.startEditing()
editor.startOperation()
myUtilityNetwork.DeleteContainmentAssociation(
"{8513D6CE-0416-4967-BBCC-591A1C34CF4A}")
if editor.isEditing:
editor.stopOperation()
editor.stopEditing(True)
DeleteStructualAttachmentAssociation(association_global_id)
DeleteStructualAttachmentAssociation 方法可移除结构要素和附件要素之间的 结构附件关联 。
| 名称 | 说明 | 数据类型 |
|---|---|---|
|
association_global_id |
The global ID of the specified structural attachment association in the utility network. |
String |
import arcpy
editor = arcpy.da.Editor(r"C:\testData\SDK_UtilityNetwork.geodatabase")
# Pass in the utility network layer
myUtilityNetwork = arcpy.un.UtilityNetwork(
r"C:\testData\SDK_UtilityNetwork.geodatabase\main.TestNetwork\main.TestNetwork")
if not editor.isEditing:
editor.startEditing()
editor.startOperation()
myUtilityNetwork.DeleteStructuralAttachmentAssociation(
"{549DE843-659D-499B-AF2A-FA8E47E89CAD}")
if editor.isEditing:
editor.stopOperation()
editor.stopEditing(True)
DisableSubnetworkController(table, global_id, terminal_name)
DisableSubnetworkController 方法可从设备或交汇点对象上的终端移除子网控制器分配。
| 名称 | 说明 | 数据类型 |
|---|---|---|
|
table |
The table name to which the subnetwork controller is assigned. |
String |
|
global_id |
The global ID for the feature to which the subnetwork controller is assigned. |
String |
|
terminal_name |
The name of the terminal to which the subnetwork controller is assigned. |
String |
import arcpy
editor = arcpy.da.Editor(r"C:\testData\SDK_UtilityNetwork.geodatabase")
myUtilityNetwork = arcpy.un.UtilityNetwork(
r"C:\testData\SDK_UtilityNetwork.geodatabase\main.TestNetwork\main.TestNetwork")
if not editor.isEditing:
editor.startEditing()
editor.startOperation()
myUtilityNetwork.DisableSubnetworkController(
"ElecDistDevice", "{A6BFF336-92F9-45F0-8ACE-AAD6137E5E2B}", "Side1")
if editor.isEditing:
editor.stopOperation()
editor.stopEditing(True)
EnableSubnetworkController(table, global_id, terminal_name, subnetwork_controller_name, subnetwork_name, tier_name, description, notes)
EnableSubnetworkController 方法可启用一个子网控制器。
子网控制器在设备或交汇点对象的终端上进行设置,以表示子网的起点。
| 名称 | 说明 | 数据类型 |
|---|---|---|
|
table |
The table name to which the new subnetwork controller will be assigned. |
String |
|
global_id |
The global ID for the feature to which the new subnetwork controller will be assigned. |
String |
|
terminal_name |
The name of the terminal on which the new subnetwork controller will be assigned. |
String |
|
subnetwork_controller_name |
The name of the new subnetwork controller. |
String |
|
subnetwork_name |
The name of the subnetwork on which the subnetwork controller participates. |
String |
|
tier_name |
The name of the tier to which the subnetwork controller belongs. |
String |
|
description |
A description of the new subnetwork controller. |
String |
|
notes |
Notes for the new subnetwork controller. |
String |
返回值
| 数据类型 | 说明 |
|---|---|
|
Integer |
子网表中新行的对象 ID。 |
import arcpy
editor = arcpy.da.Editor(r"C:\testData\SDK_UtilityNetwork.geodatabase")
# Pass in the utility network layer
myUtilityNetwork = arcpy.un.UtilityNetwork(
r"C:\testData\SDK_UtilityNetwork.geodatabase\main.TestNetwork\main.TestNetwork")
if not editor.isEditing:
editor.startEditing()
editor.startOperation()
object_id = myUtilityNetwork.EnableSubnetworkController(
"PipelineDevice", "{560FCA60-62B4-4B40-8CD9-9986AD63FA10}", "Terminal One",
"#2-213 - Batchelder HP T1", "213 - Batchelder HP", "Cathodic Read Location",
"Some Description", "No Notes")
if editor.isEditing:
editor.stopOperation()
editor.stopEditing(True)
HasValidNetworkTopology()
HasValidNetworkTopology 方法可检查是否已启用网络拓扑。
在创建关联和修改子网控制器之前,确保公共设施网络的拓扑已启用非常有用。
返回值
| 数据类型 | 说明 |
|---|---|
|
Boolean |
如果返回的布尔值为 True,则表示公共设施网络的拓扑已启用。 |
import arcpy
myUtilityNetwork = arcpy.un.UtilityNetwork(
r"C:\path\to\data\testdata1.sde\ELEC.TestNetwork\ELEC.TestNetwork")
is_valid = myUtilityNetwork.HasValidNetworkTopology()