Unable to export Network trace result in csv or feature service

185
0
01-18-2024 01:36 AM
NarendranathMandal
New Contributor II

How to export the graphics results data  ? 

I tried to trigger the events which is documented in the api documentation  add-result-area. But the event is not working.

Here my code is below

 

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta
      name="viewport"
      content="initial-scale=1,maximum-scale=1,user-scalable=no"
    />
    <title>
      UtilityNetworkTrace widget | Sample | ArcGIS Maps SDK for JavaScript 4.28
    </title>

    <link
      rel="stylesheet"
    />
    <script src="https://js.arcgis.com/4.28/"></script>

    <style>
      html,
      body,
      #viewDiv {
        padding: 0;
        margin: 0;
        height: 100%;
        width: 100%;
      }
    </style>
    <script>
      require([
        "esri/WebMap",
        "esri/views/MapView",
        "esri/widgets/UtilityNetworkTrace",
        "esri/config",
        "esri/widgets/LayerList",
        "esri/core/reactiveUtils"
      ], (WebMap, MapView, UtilityNetworkTrace, esriConfig, LayerList, reactiveUtils) => {
        // Set the hostname to the on-premise portal
        // Enterprise example: esriConfig.portalUrl = "https://myHostName.esri.com/arcgis";
        esriConfig.portalUrl = "https://www.arcgis.com"; // this is the default

        // Initialize the WebMap and pass in the webmap id
        // Credentials to sign in to the webmap:
        // username: viewer01
        // password: I68VGU^nMurF
        const webmap = new WebMap({
          portalItem: {
            // autocasts as new PortalItem()
            id: "471eb0bf37074b1fbb972b1da70fb310" // webmap id
          }
        });

        // Initialize the view
        const view = new MapView({
          container: "viewDiv",
          map: webmap
        });

        const layerlist = new LayerList({
          view: view
        })

        view.ui.add(layerlist, {position: 'top-left'})

        // Initialize the UtilityNetworkTrace widget without any set parameters
        const utilityNetworkTrace = new UtilityNetworkTrace({
          view: view,
          resultAreaProperties: {
            show: true
          },
          enableResultArea: true
        });
       
        // Add the widget to the view
        view.ui.add(utilityNetworkTrace, "top-right");
        utilityNetworkTrace.on('add-result-area', test) // working
        //utilityNetworkTrace.on('add-result-area', test) // not working
        reactiveUtils.watch(() => view.layerViews, () => {
          alert('Getting the Trace Result area')
        })
        function test(graphic){
          console.log(graphic)
          alert('Getting the Trace Result area')
        }
       
      });
    </script>
  </head>

  <body>
    <div id="viewDiv"></div>
  </body>
</html>
Tags (1)
0 Kudos
0 Replies