Title Select by Association
Expands the current selection in the map based on specified utility network association types and layers.
This tool requires at least 1 record be selected.
The Selection Payload parameter must be specified in JSON as a list of dictionaries with the following keys:- fromLayers
- fromSelectionType
- associationTypes
- toLayers
- toSelectionType
Each key maps to an array of values. If the array is empty, then all valid choices are applied.
fromLayers and toLayers are the from and to side of the association, respectively. Each entry corresponds to a layer in the map.
For subtype group layers, specify as "SubtypeGroupLayer/SubtypeLayer".
fromSelectionType determines how the selection on the fromLayers is handled.
It has the following entries:
- KEEP - The selection is not changed
- CLEAR - The original selection is cleared after the associated records are selected.
When clearing the selection, this happens after all entries in the group are processed.
associationTypes is the type of association between fromLayers and toLayers.
It has the following entries:
- Junction Junction
- Contained By
- Containing
- Attached To
- Attaching
- Junction Edge From
- Junction Edge Midspan
- Junction Edge To
toSelectionType determines how the associated features are selected in the toLayers.
It has the following entries:
- NEW
- DIFFERENCE
- INTERSECT
- SYMDIFFERENCE
- UNION
Grouping similar entries reduces the number of queries to find associated records. Entries are processed in the order they appear, not the value of the group.
License
BasicToolset
Utility Network
AssociationSelection (in_utility_network, {layer_payload}, {json_payload})
Parameter | Explanation | Data Type |
---|---|---|
in_utility_network |
Dialog Reference
The utility network that controls the selected layers. |
GPUtilityNetworkLayer |
layer_payload (Optional) |
Dialog Reference
The layers and selection types to apply. For more help, see the tool usage. |
GPValueTable |
json_payload (Optional) |
Dialog Reference
The layers and selection types to apply. For more help, see the tool usage. |
GPString |
AssociationSelection example 1 (Python window)
Select all associated records.
import arcpy
arcpy.udms.AssociationSelection("Naperville Network")
AssociationSelection example 2 (stand-alone script)
Selects all polygons that contain the selected transformers.
import arcpy
un = "Naperville Network"
payload = [
(0, "Electric Device/High Voltage Transformer", "KEEP", "CONTAINED_BY", "Structure Boundary", "UNION"),
(0, "Electric Device/Medium Voltage Transformer", "KEEP", "CONTAINED_BY", "Structure Boundary", "UNION"),
(0, "Electric Device/Low Voltage Transformer", "KEEP", "CONTAINED_BY", "Structure Boundary", "UNION"),
]
# The equivalent json payload
json_payload = [
{
"fromLayers": [
"Electric Device/High Voltage Transformer",
"Electric Device/Low Voltage Transformer",
"Electric Device/Medium Voltage Transformer",
],
"fromSelectionType": "KEEP",
"associationTypes": ["Contained By"],
"toLayers": ["Structure Boundary"],
"toSelectionType": "UNION",
}
]
count = arcpy.udms.AssociationSelection(
in_utility_network=un,
json_payload=None,
layer_payload=payload,
)
print(f"{int(count[0]):,} records selected")