Select to view content in your preferred language

Esri JS API Export to SHP using ExtractData

672
0
09-06-2023 02:35 PM
patryks
Emerging Contributor

I want to export features to shapefile by calling the following rest service:

 

arcgis/rest/services/System/SpatialAnalysisTools/GPServer/ExtractData/execute

 

According to documentation: https://developers.arcgis.com/rest/analysis/api-reference/extract-data.htm the required parameter is "inputLayers" which can be either URL reference or FeatureSet.

First I tried URL reference as inputLayers:

 

[{"url":"url","serviceToken":"token","filter":"objectid = 109002"}]

 

 

and received an error: "Error executing tool. ExtractData : {\"messageCode\": \"AO_100289\", \"message\": \"Environment connection error. Contact Esri Support Services.\"}


So now I tried to send FeatureSet. I don't know how to create one from scratch so i used layer.queryFeatures which should return FeatureSet:

const query = {
where: "objectid = 109002",
outFields: ["*"],
returnGeometry: true
};

layer.queryFeatures(query);

Sending the result to ExtractData results in following error:

"Invalid value for parameter inputLayers - Details : "

Also tried creating featureCollection with the same error as above. 

 

How to properly use ExtractData service or maybe there is an easier way to export data do shapefile?

 

0 Kudos
0 Replies