This class contains metadata about the utility network dataset
retrieved from a WebMap. To access the full properties, users need
to call webmap's load() method. Certain properties are available without calling load
such as id
and title
. In 4.20, this object can only be retrieved from a webmap which has a utility network layer.
require([
"esri/WebMap",
"esri/views/MapView",
"esri/config"
], (WebMap, MapView, esriConfig) => {
let utilityNetwork;
// set the hostname to the portal instance
esriConfig.portalUrl = "https://myHostName.domain.com/arcgis";
const webMap = new WebMap({
portalItem: {
id: "webmapID"
}
});
const mapView = new MapView({
map: webMap
});
webMap.when(async () => {
// check if webMap contains utility networks
if (webMap.utilityNetworks.length > 0) {
// assign the utility network at index 0
utilityNetwork = webMap.utilityNetworks.at(0);
// trigger the loading of the UtilityNetwork instance
await utilityNetwork.load();
}
});
});
Constructors
-
new UtilityNetwork(properties)
-
Parameterproperties Objectoptional
See the properties for a list of all the properties that may be passed into the constructor.
Property Overview
Name | Type | Summary | Class |
---|---|---|---|
Object | The full network definition, accessible only when the network is loaded. more details | Network | |
String | The physical dataset name of the network as defined in the backend database. more details | Network | |
String | The name of the class. more details | Accessor | |
String[] | Returns all the domain networks in the utility network. more details | UtilityNetwork | |
String | Returns the root feature service url which this network is part of. more details | Network | |
Extent | The full extent of the network, defined from the service territory used to create the network. more details | Network | |
String | Random unique id (UUID) to identify a network as defined in the webmap spec. more details | Network | |
Number | The layer id of the network. more details | Network | |
String | The full url to the network layer id as defined in the webmap spec. more details | Network | |
Boolean | Indicates whether the network instance has loaded. more details | Network | |
Error | The Error object returned if an error occurred while loading. more details | Network | |
String | Represents the status of a load operation. more details | Network | |
Object[] | A list of warnings which occurred while loading. more details | Network | |
String | Returns the url of network server. more details | Network | |
NetworkSystemLayers | Contains the url and IDs of the utility network rules, subnetworks, and dirty areas tables or layers. more details | UtilityNetwork | |
String | The portal user owner of the network. more details | Network | |
String | Converts url to a url object more details | Network | |
Number | The layer id of the service containing the utility network rules table. more details | UtilityNetwork | |
String | The service url containing the utility network rules table. more details | UtilityNetwork | |
Number | The schema version of the network. more details | Network | |
Number | The layer id of the service territory class used to define the extent of the utility network. more details | UtilityNetwork | |
NamedTraceConfiguration[] | This property returns the list of trace configurations shared on the webmap. more details | UtilityNetwork | |
Object | more details | Network | |
SpatialReference | The spatial reference of the network, defined at the creation of the network, usually from the service territory class. more details | Network | |
Number | The layer id of the service containing the utility network's Subnetworks table. more details | UtilityNetwork | |
String | The service url containing the utility network's Subnetworks table. more details | UtilityNetwork | |
TerminalConfiguration[] | Returns all the terminal configurations on the utility network. more details | UtilityNetwork | |
String | The name of the network as defined in the webmap spec. more details | Network | |
String | The type of the dataset. more details | UtilityNetwork |
Property Details
-
The full network definition, accessible only when the network is loaded.
-
The physical dataset name of the network as defined in the backend database. Accessible only when the network is loaded.
-
The name of the class. The declared class name is formatted as
esri.folder.className
.
-
Returns all the domain networks in the utility network. Domain networks contain the network features through which your delivered resource flows.
- See also
-
Returns the root feature service url which this network is part of.
Example`https://utilitynetwork.esri.com/server/rest/services/NapervilleElectric/FeatureServer/`
-
The full extent of the network, defined from the service territory used to create the network.
-
Random unique id (UUID) to identify a network as defined in the webmap spec. Generated during sharing of the webmap.
-
The layer id of the network.
-
The full url to the network layer id as defined in the webmap spec. e.g.
https://utilitynetwork.esri.com/server/rest/services/NapervilleElectric/FeatureServer/17
(where 17 is the layer id of the network)
-
Indicates whether the network instance has loaded. When
true
, all the properties of the object can be accessed.- Default Value:false
-
The Error object returned if an error occurred while loading.
- Default Value:null
-
Represents the status of a load operation.
Value Description not-loaded The object's resources have not loaded. loading The object's resources are currently loading. loaded The object's resources have loaded without errors. failed The object's resources failed to load. See loadError for more details. Possible Values:"not-loaded"|"loading"|"failed"|"loaded"
- Default Value:not-loaded
-
A list of warnings which occurred while loading.
-
Returns the url of network server.
Example`https://utilitynetwork.esri.com/server/rest/services/NapervilleElectric/UtilityNetworkServer/`
-
networkSystemLayers NetworkSystemLayersreadonly
-
Contains the url and IDs of the utility network rules, subnetworks, and dirty areas tables or layers.
Example// Print out the dirty areas layer url in the utility network view.when(async () => { // Check if the webmap contains utility networks if(webmap?.utilityNetworks?.length > 0) { // Assigns the utility network at index 0 utilityNetwork = webmap.utilityNetworks.at(0); // Load the utility network await utilityNetwork.load(); // Print the dirty areas layer url and id console.log(`Dirty areas layer id: ${utilityNetwork.networkSystemLayers.dirtyAreasLayerId}`); console.log(`Dirty areas layer url: ${utilityNetwork.networkSystemLayers.dirtyAreasLayerUrl}`); } });
-
The portal user owner of the network. This portal user can perform administrive actions against the network.
-
Converts url to a url object
-
rulesTableId NumberreadonlyDeprecated since version 4.25. Use networkSystemLayers.rulesTableId instead.
-
The layer id of the service containing the utility network rules table.
- See also
-
rulesTableUrl StringreadonlyDeprecated since version 4.25. Use networkSystemLayers.rulesTableUrl instead.
-
The service url containing the utility network rules table.
- See also
-
The schema version of the network. Each version of the network introduces new features and capabilities. e.g. A utility network created with ArcGIS Pro 2.8 will have a schema generation version 5. While a UN created with ArcGIS Pro 2.6 will be version 4.
-
serviceTerritoryFeatureLayerId Numberreadonly
-
The layer id of the service territory class used to define the extent of the utility network. Value is
null
when a service territory layer is not published to the feature service.
-
-
This property returns the list of trace configurations shared on the webmap. It is empty when no trace configurations are shared on the webmap. This property can be used without fully loading the utility network, but only the
globalId
and thetitle
will be available.
-
spatialReference SpatialReference inherited
-
The spatial reference of the network, defined at the creation of the network, usually from the service territory class.
-
subnetworksTableId NumberreadonlyDeprecated since version 4.25. Use networkSystemLayers.subnetworksTableId instead.
-
The layer id of the service containing the utility network's Subnetworks table. The Subnetworks table contains the information about all the existing and deleted subnetworks in a utility network.
- See also
-
subnetworksTableUrl StringreadonlyDeprecated since version 4.25. Use networkSystemLayers.subnetworksTableUrl instead.
-
The service url containing the utility network's Subnetworks table.
- See also
-
terminalConfigurations TerminalConfiguration[]readonly
-
Returns all the terminal configurations on the utility network. Terminal configurations defines how many terminals a device has and how those terminals are setup. Must load the utility network to access this.
- See also
-
The name of the network as defined in the webmap spec. Represents the layer name of the network layer defined while sharing the webmap.
-
type Stringreadonly
-
The type of the dataset. Returns
utility
if the object represents a utility network.For UtilityNetwork the type is always "utility".
- Default Value:"utility"
Method Overview
Name | Return Type | Summary | Class |
---|---|---|---|
Adds one or more handles which are to be tied to the lifecycle of the object. more details | Accessor | ||
Cancels a load() operation if it is already in progress. more details | Network | ||
* | Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product. more details | Network | |
Number | The network consists of sources (classes) and each source has a unique Id. more details | Network | |
TerminalConfiguration | All devices features have terminal configurations (default single terminal). more details | UtilityNetwork | |
String[] | Takes the name of a domain network and returns an array with the names of its tiers. more details | UtilityNetwork | |
Boolean | Returns true if a named group of handles exist. more details | Accessor | |
Boolean |
| Network | |
Boolean |
| Network | |
Boolean |
| Network | |
Promise | Triggers the loading of the UtilityNetwork instance. more details | UtilityNetwork | |
Promise<NamedTraceConfiguration[]> | Named trace configurations allow you to add and store complex traces in a network that can be shared across an organization through web maps and consumed by web and field applications. more details | Network | |
Removes a group of handles owned by the object. more details | Accessor | ||
Promise<TopologyValidationJobInfo> | Whenever the network is edited or modified, the network and its features become out of date in the network topology. more details | UtilityNetwork | |
Promise<TraceJobInfo> | Takes the traceProps and preforms an async trace on a UtilityNetwork. more details | UtilityNetwork | |
Object | Converts an instance of this class to its ArcGIS portal JSON representation. more details | Network | |
Promise<TraceResult> | Takes the traceProps and preforms a trace on a UtilityNetwork. more details | UtilityNetwork | |
Promise<ValidateNetworkTopologyResult> | Whenever the network is edited or modified, the network and its features become out of date in the network topology. more details | UtilityNetwork | |
Promise |
| Network |
Method Details
-
addHandles(handleOrHandles, groupKey)inheritedSince: ArcGIS Maps SDK for JavaScript 4.25
-
Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.
// Manually manage handles const handle = reactiveUtils.when( () => !view.updating, () => { wkidSelect.disabled = false; }, { once: true } ); this.addHandles(handle); // Destroy the object this.destroy();
ParametershandleOrHandles WatchHandle|WatchHandle[]Handles marked for removal once the object is destroyed.
groupKey *optionalKey identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.
-
fromJSON(json){*}static
-
Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product. The object passed into the input
json
parameter often comes from a response to a query operation in the REST API or a toJSON() method from another ArcGIS product. See the Using fromJSON() topic in the Guide for details and examples of when and how to use this function.Parameterjson ObjectA JSON representation of the instance in the ArcGIS format. See the ArcGIS REST API documentation for examples of the structure of various input JSON objects.
ReturnsType Description * Returns a new instance of this class.
-
The network consists of sources (classes) and each source has a unique Id. These source Ids are used to perform traversal in the network topology. The trace end points are not aware of layers and only returns sources of results. This method returns the layerId for given a source Id. Used as a helper method to process trace results.
Parameterid NumberThe id of the source.
ReturnsType Description Number The layer id.
-
getTerminalConfiguration(feature){TerminalConfiguration}
-
All devices features have terminal configurations (default single terminal). Users can use this method to retrieve the assigned terminal configuration of a given feature. This method takes a graphic/feature, uses the
ASSETGROUP
andASSETTYPE
fields along side the network source to find out the assigned terminal configuration. If eitherASSETGROUP
,ASSETTYPE
orlayer
are not populated anull
is returned. Returnsnull
if terminal configuration object couldn't be found.Parameterfeature GraphicThe graphic feature to get the terminal configuration from. Must belong to a device layer, and have
ASSETGROUP
andASSETTYPE
fields populated.ReturnsType Description TerminalConfiguration The terminal configuration object. Most devices have a single terminal configuration unless configured otherwise.
-
Takes the name of a domain network and returns an array with the names of its tiers. A domain network can have one or several tiers. A tier is a subgrouping of a domain network that represents the logical hierarchy of subnetworks.
ParameterdomainNetworkName StringThe name of the domain network.
ReturnsType Description String[] Returns an array of tier names.
-
Since: ArcGIS Maps SDK for JavaScript 4.25
-
Returns true if a named group of handles exist.
ParametergroupKey *optionalA group key.
ReturnsType Description Boolean Returns true
if a named group of handles exist.Example// Remove a named group of handles if they exist. if (obj.hasHandles("watch-view-updates")) { obj.removeHandles("watch-view-updates"); }
-
isFulfilled()
may be used to verify if creating an instance of the class is fulfilled (either resolved or rejected). If it is fulfilled,true
will be returned.ReturnsType Description Boolean Indicates whether creating an instance of the class has been fulfilled (either resolved or rejected).
-
isRejected()
may be used to verify if creating an instance of the class is rejected. If it is rejected,true
will be returned.ReturnsType Description Boolean Indicates whether creating an instance of the class has been rejected.
-
isResolved()
may be used to verify if creating an instance of the class is resolved. If it is resolved,true
will be returned.ReturnsType Description Boolean Indicates whether creating an instance of the class has been resolved.
-
load(){Promise}
-
Triggers the loading of the UtilityNetwork instance.
Fully loads the utility network definition and all the shared named trace configurations.
ReturnsType Description Promise Resolves when the UtilityNetwork is loaded.
-
Since: ArcGIS Maps SDK for JavaScript 4.25
-
Named trace configurations allow you to add and store complex traces in a network that can be shared across an organization through web maps and consumed by web and field applications. This method returns a list of NamedTraceConfiguration objects that meet specific search conditions. Used to find existing named trace configurations in a utility network.
Parametersquery ObjectoptionalThe query parameters that are used to determine which named trace configurations will be returned.
Specificationoptional An array of the named trace configuration creators to be queried.
optional An array of named trace configuration globalIds (UUID) to be queried.
optional An array of named trace configuration names to be queried.
optional An array of named trace configuration user tags to be queried.
options RequestOptionsoptionalThe request options specified by the user in the data request. See RequestOptions for available properties.
ReturnsType Description Promise<NamedTraceConfiguration[]> Resolves with an array of named trace configurations filtered based on the query parameters. Examples// Initialize the query object with global IDs of the named trace configurations to query. const query = { globalIds: ["5dbb5a13-ab2f-452d-bfcb-6f98154ccb9d", "cf568e46-f200-486c-adb1-d008a3da0ed1"], } // Query the utility network named trace configurations // and filter the results by the query object. const namedTraceConfigurations = await utilityNetwork.queryNamedTraceConfigurations(query); // Print the named trace configurations to the console. console.log(namedTraceConfigurations)
// Calling this method without parameters returns all named trace configurations in the utility network. const namedTraceConfigurations = await utilityNetwork.queryNamedTraceConfigurations(); // Print all the named trace configurations to the console. console.log(namedTraceConfigurations);
-
removeHandles(groupKey)inheritedSince: ArcGIS Maps SDK for JavaScript 4.25
-
Removes a group of handles owned by the object.
ParametergroupKey *optionalA group key or an array or collection of group keys to remove.
Exampleobj.removeHandles(); // removes handles from default group obj.removeHandles("handle-group"); obj.removeHandles("other-handle-group");
-
submitTopologyValidationJob(parameters, options){Promise<TopologyValidationJobInfo>}Since: ArcGIS Maps SDK for JavaScript 4.26
-
Whenever the network is edited or modified, the network and its features become out of date in the network topology. Validating the network topology maintains consistency and up-to-date content between the feature editing space and network topology space. Validating a network topology may include all or a subset of the dirty areas layer present in the network.
Parametersparameters esri/networks/Network~ValidateNetworkTopologyPropsThe parameters that are used to validate the network topology.
options RequestOptionsoptionalThe request options specified by the user in the data request. See RequestOptions for available properties.
ReturnsType Description Promise<TopologyValidationJobInfo> Resolves with the results returned from validating network topology. Exampleconst extent = new Extent({ xmin: 470789.0888, ymin: 3597733.2051, xmax: 531454.2759999996, ymax: 3639864.802100001, spatialReference: { wkid: 26911, latestWkid: 26911 } }); const validationResult = await network.submitTopologyValidationJob({ validateArea: extent, gdbVersion: "sde.DEFAULT", validationType: "rebuild", validationSet: [ { sourceId: 4134325151, globalIds: ["{7865BAA6-ED9C-4346-9F72-894A49E10C73}"] } ] });
-
submitTraceJob(props){Promise<TraceJobInfo>}Since: ArcGIS Maps SDK for JavaScript 4.27
-
Takes the traceProps and preforms an async trace on a UtilityNetwork.
ParametersSpecificationprops ObjectoptionalProps consists of namedTraceConfigurationGlobalId, traceLocations, outSpatialReference, traceConfiguration, resultTypes, and traceType.
SpecificationnamedTraceConfigurationGlobalId StringoptionalThe globalId (UUID) of the named trace configuration persisted in the network.
gdbVersion StringoptionalThe geodatabase version to execute the function against. Defaults to
SDE.DEFAULT
when no version is provided.traceLocations TraceLocation[]optionalThe list of starting points and barriers that will define where the trace starts and stops. This parameter can be optional (defaults to empty array) if minStartingPoints in
NamedTraceConfiguration
is set tonone
.outSpatialReference SpatialReferenceoptionalThe spatial reference that should be used to project the aggregated geometries returned by the trace (if applicable).
traceConfiguration UNTraceConfigurationoptionalDefines the properties of a trace.
resultTypes ResultTypeJSON[]optionalParameter specifying the types of results to return after running a trace.
traceTypes StringoptionalThe traceType defined in this trace configuration.
ReturnsType Description Promise<TraceJobInfo> Returns a Promise of TraceJobInfo.
-
Converts an instance of this class to its ArcGIS portal JSON representation. See the Using fromJSON() guide topic for more information.
ReturnsType Description Object The ArcGIS portal JSON representation of an instance of this class.
-
trace(props){Promise<TraceResult>}Since: ArcGIS Maps SDK for JavaScript 4.27
-
Takes the traceProps and preforms a trace on a UtilityNetwork.
ParametersSpecificationprops ObjectoptionalProps consists of namedTraceConfigurationGlobalId, traceLocations, outSpatialReference, traceConfiguration, resultTypes, and traceType.
SpecificationnamedTraceConfigurationGlobalId StringoptionalThe globalId (UUID) of the named trace configuration persisted in the network.
gdbVersion StringoptionalThe geodatabase version to execute the function against. Defaults to
SDE.DEFAULT
when no version is provided.traceLocations TraceLocation[]optionalThe list of starting points and barriers that will define where the trace starts and stops. This parameter can be optional (defaults to empty array) if minStartingPoints in
NamedTraceConfiguration
is set tonone
.outSpatialReference SpatialReferenceoptionalThe spatial reference that should be used to project the aggregated geometries returned by the trace (if applicable).
traceConfiguration UNTraceConfigurationoptionalDefines the properties of a trace.
resultTypes ResultTypeJSON[]optionalParameter specifying the types of results to return after running a trace.
traceTypes StringoptionalThe traceType defined in this trace configuration.
ReturnsType Description Promise<TraceResult> Returns a Promise of TraceResult.
-
validateTopology(parameters, options){Promise<ValidateNetworkTopologyResult>}Since: ArcGIS Maps SDK for JavaScript 4.26
-
Whenever the network is edited or modified, the network and its features become out of date in the network topology. Validating the network topology maintains consistency and up-to-date content between the feature editing space and network topology space. Validating a network topology may include all or a subset of the dirty areas present in the network.
Parametersparameters ValidateTopologyPropsThe parameters that are used to validate the network topology.
options RequestOptionsoptionalThe request options specified by the user in the data request. See RequestOptions for available properties.
ReturnsType Description Promise<ValidateNetworkTopologyResult> Resolves with the results returned from validating network topology. Exampleconst extent = new Extent({ xmin: 470789.0888, ymin: 3597733.2051, xmax: 531454.2759999996, ymax: 3639864.802100001, spatialReference: { wkid: 26911, latestWkid: 26911 } }); const result = await network.validateTopology({ validateArea: extent });
-
when()
may be leveraged once an instance of the class is created. This method takes two input parameters: acallback
function and anerrback
function. Thecallback
executes when the instance of the class loads. Theerrback
executes if the instance of the class fails to load.Parameterscallback FunctionoptionalThe function to call when the promise resolves.
errback FunctionoptionalThe function to execute when the promise fails.
ReturnsType Description Promise Returns a new promise for the result of callback
that may be used to chain additional functions.Example// Although this example uses MapView, any class instance that is a promise may use when() in the same way let view = new MapView(); view.when(function(){ // This function will execute once the promise is resolved }, function(error){ // This function will execute if the promise is rejected due to an error });