Select to view content in your preferred language

Validate Network Topology in a Web Application

827
5
02-26-2024 11:17 PM
Acharya
Occasional Contributor

Hello everyone,

I am trying to develop a web application with Utility Network with ArcGIS Javascript SDK (4.27). I have prepared a Web Application with Utility Network widget and now I am trying to add the validate network topology widget. I have added the widget in this application but it does not allow me to validate the network topology. 

The error/warning is that "A utility Network wasn't provided. the widget must be initialized with a utiltity network". However, I have already checked and it does have utility NEtwork. I am also able to perform tracing in UN Tracing widget.

In this application, I have used Web Map with UN feature service in it. The feature layer is shared from ArcGIS PRO (via Publish Web Layer).

QUESTIONS:

  1. If the warning is ""noDirtyAreasLayer": "Couldn't find the dirty areas layer. Add the dirty areas layer to the map.".
    1. How can I add dirty Area layer in the Web Map? Should I add Feature Service or the Map Service? 
  2. What are the use cases of Feature Service and Map Service? I am not sure for which case should I use feature service and for what is map service useful.

It would be of great help. Thanks a lot in advance.

 

Best Regards

Shlesha

5 Replies
leomonterol
Esri Contributor

Hello Shlesha,

Here's a link to a sample app showing how to use the Validate Network Topology widget using ArcGIS Maps SDK for JavaScript 4.27 (Credentials to access the app can be found inline). 

https://codepen.io/lmontero_esri/pen/poQwwPP

Even if your map already has a Utility Network, you need to explicitly set it in the widget's "utilityNetwork" property as shown below

 

// Initialize the custom widget and set its properties using the constructor
const vntWidget = new UtilityNetworkValidateTopology({
  view: myView,
  utilityNetwork: myUtilityNetwork
});

 


To answer your questions:

1. To use the Validate Network Topology widget, you need to add the dirty areas layer as a FeatureLayer (The sample app shows how to do it. Hint: Look for the "addDirtyAreasLayer" function). Here's a link to the SDK documentation showing how to create a featureLayer from a feature service URL.

https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#construc...

2. Here's a great answer I found in a page created by the Technical Support team (originally posted here)

"A map service does not expose the editing capability and provides read-only access to feature and attribute content, while a feature service contains the information from feature layers that can be edited if editing is enabled. Clients can query and edit the feature geometry and attributes of a feature service."

On the SDK side of things, the layer you choose dictates which capabilities will be available. Here's a link to a document showing info on data storage and capabilities for some layer classes.

https://developers.arcgis.com/javascript/latest/layers/

I hope you find this information useful.


Kind Regards,
Leo

0 Kudos
Acharya
Occasional Contributor

Hi Leo,

Thank you so much for the reply. I could access the script for the Validate Network Topology Widget. I have tried to add the widget according to the sample code. Unfortunately the error still exists. Even though the dirty area layer and also the utility Network Area is added on the Map, the widget is not able to recognise the Utility Network.

Acharya_0-1709292390529.png

Acharya_1-1709292571241.png

Best Regards
Shlesha

0 Kudos
leomonterol
Esri Contributor

Hello Shlesha,

Can you provide me with a copy of your code or at least a code snippet showing how your UtilityNetworkValidateTopology widget is being initialized so I can take a look at it?

Kind Regards,
Leo

0 Kudos
Acharya
Occasional Contributor

Hi Leo,

Thank you so much for the help.
I am quite new in working with Javascript SDK. 
Here, are some of the snippet of the code.   
 

Loading the Utility Network.

Acharya_0-1709711667462.png

Function to add Dirty Area Layer in the Code.

Acharya_2-1709711833443.png

Initializing the UN Validate Topology Widget.

Acharya_3-1709711888785.png

Best Regards

Shlesha

 

 

 

 

0 Kudos
LeoMontero
New Contributor

Hello Shlesha,

I was wondering, do you get the same error message while working with Maps SDK for JavaScript 4.28,  4.29? 

Also, do you know what version of ArcGIS Enterprise was your Utility Network published to?

Finally, can you create a pen I could use to plug my own data in to see if I can reproduce this behavior on my end?


Kind Regards,
Leo

0 Kudos