Associations.png file) or a document, that is associated with individual features in a geodatabase or feature layer.
| Association | Description | Geometry supported |
|---|---|---|
| Connectivity | Models the connectivity between two junctions that don’t have geometric coincidence (are not in the same x, y and z location). A transformer may be connected to a fuse, for example. | Yes |
| Structural attachment | Models equipment attached to structures. A transformer bank may be attached to a pole, for example. | Yes |
| Containment | Models assets that contain other assets. A vault may contain valves and pipes, for example. | No |

// Get the elements associated (by containment) with a specified utility element. final utilityAssociations = await _utilityNetwork.getAssociations( element: containerElement, type: UtilityAssociationType.containment, ); // Iterate all associations for this element. for (final association in utilityAssociations) { // Get the first ("from") and second ("to") elements in the association. final fromElement = association.fromElement; final toElement = association.toElement; }You can also provide an envelope to find all valid associations within the specified extent.
The following shows a graphics overlay to display all associations within the map extent using a unique symbol for each association type.
// Get the current viewpoint's extent. final viewpoint = _mapViewController.getCurrentViewpoint(ViewpointType.boundingGeometry);
if (viewpoint == null) return;
final extent = viewpoint.targetGeometry as Envelope;
// Create symbols for structural attachment and connectivity associations. final attachmentSymbol = SimpleLineSymbol( style: SimpleLineSymbolStyle.dot, color: Colors.green, width: 5, ); final connectivitySymbol = SimpleLineSymbol( style: SimpleLineSymbolStyle.dot, color: Colors.red, width: 5, );
// Create unique value renderer for the associations and apply it to the graphics overlay. final attachmentValue = UniqueValue( description: 'Attachment', symbol: attachmentSymbol, values: [UtilityAssociationType.attachment.name], ); final connectivityValue = UniqueValue( description: 'Connectivity', symbol: connectivitySymbol, values: [UtilityAssociationType.connectivity.name], ); _graphicsOverlay.renderer = UniqueValueRenderer( fieldNames: ['AssociationType'], uniqueValues: [attachmentValue, connectivityValue], );
// Get all of the associations in the current extent. try { final utilityAssociations = await _utilityNetwork.getAssociationsWithEnvelope(extent);
for (final utilityAssociation in utilityAssociations) { // If it's not a containment relationship, add a graphic for the association. if (utilityAssociation.associationType != UtilityAssociationType.containment) { final graphic = Graphic( geometry: utilityAssociation.geometry, attributes: { 'GlobalId': utilityAssociation.globalId, 'AssociationType': utilityAssociation.associationType.name, }, ); _graphicsOverlay.graphics.add(graphic); } } } catch (e) { // Handle error (show error message, etc.) debugPrint('Error getting associations: $e'); }Specifying a utility element
Specifying an extent will return all its connectivity or structural attachment associations with geometry. The geometry value (polyline) represents the connection relationship between a from element and a to element. You can use the geometry to visualize the association as a graphic