custom widget - How can javascript download from url of zipped shapefile into my 3D Scene, with minimum manual operations?

515
1
Jump to solution
08-13-2020 04:32 AM
MichaelLev
Occasional Contributor III

I adapted the code in FME Server Playground - Upload File In Session into my ESRI Web AppBuilder custom-widget javascript code, and after uploading input file to my FME cloud and running the cloud workspace, all by javascript alone, the returned json has the url of the result zipped shapefile.

 

Now I want to import the zipped shapefile into my 3D scene, with minimum manual user operations, but mainly by the javascript code.

 

My questions:

  1. Can I import the url directly to my scene?
  2. Is there some "magic" javascript code to download it by my web application without displaying explorer download dialog to the user? And that my javascript will know the downloaded path? Perhaps by "fetch" (which I am not familiar to)? If yes, how?
  3. Next code snippet displays an explorer download dialog to the user, but how can I set a promise to know WHEN the user finished? either by cancelling or approving the download, and what is the final path and name of the downloaded zip, since the user can change things in the explorer download dialog? and since I don't know how to "connect" to the explorer download dialog box?
        let a = document.createElement("a");
        a.style = "display: none";
        a.href = obj.zipUrl;a.click();
  4. After my widget javascript code has the path to the ziped shapefile in the PC, since it's my first time of doing such thing - I will appreciate to get links/code examples how to import it into the Scene. I now learning the example in Create a FeatureLayer from a shapefile, but are there preferred documents/links or code examples to learn from?

I'll greatly appreciate help how to do it.

 

Michael

0 Kudos
1 Solution

Accepted Solutions
MichaelLev
Occasional Contributor III

I assume it is impossible in WAB to import directly from url of zipped shapefile(s) into my scene.

So I had to download the zip into my PC, and I developed custom widget to import from zip file in my PC into my 3D scene.

Michael

View solution in original post

0 Kudos
1 Reply
MichaelLev
Occasional Contributor III

I assume it is impossible in WAB to import directly from url of zipped shapefile(s) into my scene.

So I had to download the zip into my PC, and I developed custom widget to import from zip file in my PC into my 3D scene.

Michael

0 Kudos