How to Export from WFS to SHP or KMZ in WebApp builder?

1681
1
05-28-2020 04:30 PM
by Anonymous User
Not applicable

I know this question has been asked a few time on here, but I don't seem to be getting a clear answer. 

We have serveral WFS & WMS services published on our ArcServer machines and want users to be able to extract them. 

We want users to select parcels with a tool then allow them to export to shpfile or kmz with a simple UI in a WebApp. 

This is what I've tried so far. 

1. Geoprocessing service example: Clip And Ship—ArcMap | ArcGIS Desktop - Not sure if this works with WFS? I can't get this to really work. Is this meant for what I'm trying to accomplish ? 

2. 

Add "Export to SHP" or "Export to GDB" option to WAB Select Widget  - 

The following work-around was provided by Esri development:

  1. Enable the “Export” capability for Select widget
  2. Use “Save to My Content” on the selection to save the selection to your portal as an Feature Collection item
  3. Go to the saved Feature Collection item’s details page
  4. Use “Publish” button to publish it as a hosted feature layer
  5. Use the “Export Data” capability of the hosted feature layer to export it to Shapefile.

This process is not ideal for us. We would also like to have KML. 

These are the Tools I have available:

FME 

ArcServer 

Portal/Enterprise

Is there a way I can publish a GP tool on our servers with the FME module. To accomplish this.

Thanks !

Tags (3)
1 Reply
EricRuberson1
New Contributor III

I've gotten this to work with geojson files. I have added a button that exports drawn shapes (generated in Robert's Modify Widget, which uses DrawBox to make them). 

I did not get it to work with kml/z and I found the same thing you did about shapefiles. Export to them is unsupported, probably because to import them they have to be zipped, so they didnt want to figure the inverse of that out.

      _onExportDrawnArea: function(){
        //get graphics layer
        //export graphics layer as geojson
        require(["jimu/BaseFeatureAction", "jimu/exportUtils", "jimu/FeatureActionManager", "esri/tasks/FeatureSet"], lang.hitch(this, function( BaseFeatureAction, exportUtils, FeatureActionManager, FeatureSet) { 
          
          var graphicFeatures= [];
          var graphicsLayerGraphics = this.graphicsLayer.graphics;
          
          for (var f = 0; f < graphicsLayerGraphics.length; f++) 
          {
            //console.log("graphicsLayerGraphics.length"+graphicsLayerGraphics.length);
            //console.log(graphicsLayerGraphics);
            graphicFeatures.push(graphicsLayerGraphics[f]);
          };
          var drawnShapeData = new FeatureSet();
          drawnShapeData.features = graphicFeatures;
          
          var ds = exportUtils.createDataSource({
            type: exportUtils.TYPE_FEATURESET,
            filename: 'features', 
            data: drawnShapeData
          });

          ds.setFormat(exportUtils.FORMAT_GEOJSON);
          ds.download();
        }));
      },
0 Kudos