Select to view content in your preferred language

ArcGIS REST API: Generate - elaborating its usage in adding shapefile

1222
3
08-17-2020 10:15 AM
MichaelLev
Frequent Contributor

Dear Robert Scheitlin, GISP‌ -

I suceeded in developing Web AppBuilder (Developer Edition) 2.16 custom widget to add zipped shapefile to 3D scene by adapting code example: Create a FeatureLayer from a shapefile.

The example uses the next code:

var params = {
    name: name,
    targetSR: view.spatialReference,
    maxRecordCount: 1000,
    enforceInputFileSizeLimit: true,
    enforceOutputJsonSizeLimit: true
};
// generalize features to 10 meters for better performance
params.generalize = true;
params.maxAllowableOffset = 10;
params.reducePrecision = true;
params.numberOfDigitsAfterDecimal = 0;

var myContent = {
    filetype: "shapefile",
    publishParameters: JSON.stringify(params),
    f: "json"
};
request(portalUrl + "/sharing/rest/content/features/generate", {
    query: myContent,
    body: document.getElementById("uploadForm"),
    responseType: "json"
})

I will appreciate explanations for the next few questions:

  1. I want to better understand the option capabilities that "params" give me.
  2. If I want to give my file by "sourceUrl" parameter (instead of using the html form), e.g. for using url of zip file in my Amazon S3 cloud, how do I exacly specify it and its accompanying parameters? because no matter how I try, I get error: "'Unable to generate features -- itemid', 'sourceUrl' or 'text' must be specified."

  3. Where can I see clear and elaborated documentation and examples of all the possible parameters of this API? since ArcGIS REST API - Generate has NO DOCUMENTATION of the parameters "query", "body", "sourceUrl", and the documentation that exists there is far from being enough (I can't know whether to use "type" or "filetype", I totally can't understand what does "text" and how to use it, etc.) - it is just superficial and tells me nothing clear what to do.

Help will be greatly appreciated,

Michael

0 Kudos
3 Replies
MichaelLev
Frequent Contributor

Robert Scheitlin, GISP‌,

Can you please refer to item "3" above? since I have not found detailed doc on ArcGIS REST API - Generate.

Michael

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

There is none that I am aware of.

MichaelLev
Frequent Contributor

Dear Robert Scheitlin, GISP,

I thank you very much for answering.

At least I know that being newbie has not caused me to miss some documentation.

I appreciate you for being a great help to many developers of esri WAB custom widgets.

Michael

0 Kudos