The JS API reference related to utility networks are here but do not have any examples. Can someone please share examples of how to get a utility network from a web map or point to a resource where they're available?
Hello @KarthikAditya ,
Thanks for providing feedback on the documentation for the UtilityNetwork. I agree we are missing some sample code in this class. The code you need to load a utility network from a webmap is the following.
const webMap = new WebMap({ portalItem: { portal: { url: "MyPortalUrl" }, id: "MyWebmapId" } }); webMap.when(async function() { // Check if webMap contains utility networks. if (webMap.utilityNetworks.length > 0 ) { // Assigns the utility network at index 0 to utilityNetwork. utilityNetwork = webMap.utilityNetworks.getItemAt(0); } // Trigger the loading of the UtilityNetwork instance. await utilityNetwork.load(); });
We will add this sample code into the UtilityNetwork class. We are also working on providing a sample and some more detailed documentation on working with utility networks with the ArcGIS API for JavaScript. Thanks again for the feedback!
Thanks,
Jose
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.