An array of analysis
This utility element may be created from a feature or asset type
Utility element from a feature
You may query for a specific feature using any of its fields or geometry or interactively identify a feature in a map viewGeoElement list immediately under IdentifyLayerResult when part of a FeatureLayer or from sublayerResults when part of a SubtypeFeatureLayer.
final query = QueryParameters() ..whereClause = "GlobalId like '{D353C10C-E617-4618-BDD0-B48EDB822D07}'"; final queryResult = await table.queryFeatures(query);
if (queryResult.features().isEmpty) return; final feature = queryResult.features().first as ArcGISFeature; final identifyLayerResults = await _mapViewController.identifyLayers( screenPoint: position, tolerance: 5, returnPopupsOnly: false, );
ArcGISFeature? sublayerFeature; ArcGISFeature? feature;
for (final layerResult in identifyLayerResults) { if (layerResult.layerContent is SubtypeFeatureLayer) { for (final subLayerResult in layerResult.sublayerResults) { for (final geoElement in subLayerResult.geoElements) { sublayerFeature = geoElement as ArcGISFeature; } } } else if (layerResult.layerContent is FeatureLayer) { for (final geoElement in layerResult.geoElements) { feature = geoElement as ArcGISFeature; } } } await feature.load(); final element = _utilityNetwork.createElement(arcGISFeature: feature);Utility element from an asset type
An asset type
var assetType = otherElement.assetType; var element = _utilityNetwork.createElementWithAssetType( assetType, globalId: globalId, );
final tableName = feature.featureTable?.tableName; if (tableName == null) return; var networkSource = _utilityNetwork.definition?.getNetworkSource(tableName);
final subtypeName = feature.getFeatureSubtype()?.name; if (subtypeName == null) return; var assetGroup = networkSource?.getAssetGroup(subtypeName); if (assetGroup == null) return;
final assetTypeCode = feature.attributes['ASSETTYPE'] as int; assetType = assetGroup.assetTypes.firstWhere((t) => t.code == assetTypeCode);
networkSource = _utilityNetwork.definition ?.getNetworkSource('Electric Distribution Device'); assetGroup = networkSource?.getAssetGroup('Service Point');
assetType = assetGroup?.getAssetType('Single Phase Low Voltage Meter') ?? assetType; element = _utilityNetwork.createElementWithAssetType( assetType, globalId: globalId, );Utility element properties
A terminal is required when a UtilityElement that supports more than one terminal
if (element.assetType.terminalConfiguration!.terminals.isNotEmpty) { element.terminal = element.assetType.terminalConfiguration!.terminals.first; }If the feature
Use UtilityElement.fractionAlongEdge to define the location of the point along the line.
The following example uses the GeometryEngine to get the fraction of a tap location along the line.
if (element.networkSource?.sourceType == UtilityNetworkSourceType.edge && feature.geometry is Polyline) { var line = feature.geometry as Polyline; if (line.hasZ) { final line2 = GeometryEngine.removeZ(line) as Polyline?; if (line2 != null) line = line2; } if (mapPoint.spatialReference != null && line.spatialReference != mapPoint.spatialReference) { final projectedLine = GeometryEngine.project( line, outputSpatialReference: mapPoint.spatialReference!, ) as Polyline?; if (projectedLine != null) line = projectedLine; } final percentAlong = GeometryEngine.fractionAlong( line: line, point: mapPoint, tolerance: double.nan, ); if (!percentAlong.isNaN) { element.fractionAlongEdge = percentAlong; } }