Select to view content in your preferred language

WAB Geoprocessing Widget URL upload

484
4
Jump to solution
01-28-2024 10:16 AM
DonMorrison1
Occasional Contributor III

I have a Python toolkit tool with a DEFile parameter type and I publish it as a geoprocessing service. Then I created a Web Application Builder geoprocessing widget to access it from ArcGIS Online. You can see in the image below how it gets rendered in the widget. When I select "Upload File", it works as expected allowing the user to select a local file which then gets uploaded to the ArcGIS Server.

DonMorrison1_0-1706465046662.png

But I don't understand how to make the URL selection work. I can see in the network trace that the URL does indeed get sent into the REST service, but by the time it reaches my python code it looks like this:

c:\arcgisserver\directories\arcgisjobs\row_dev\devorga_gptools_gpserver\j1b86d313ca9243ef9318a28bcba24ef0\scratch\1

There is no file by that name on the server.  The only thing I can think of is that my parameter type is wrong but I can't figure you what it should be. Any ideas?   In reality I would be OK without URL functionality but I can't remove it from the widget UI, so as long as it is there I'd like to have it work correctly.

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
AlexanderDanielPratama
Esri Contributor

Pardon my misunderstood. Have you tried to fill in another URL with the method GET parameter directly that contains file. I look in Esri documentation like this image below (Geoprocessing parameter types—ArcGIS Web AppBuilder | Documentation). 

AlexanderDaniel_Pratama_0-1708906095283.png

View solution in original post

4 Replies
AlexanderDanielPratama
Esri Contributor

In my experience using gpservice or WAB Geoproccessing widget , it runs purely on the script. Hence if you turn on upload file function, it uploads file from your desktop to the server. It cannot be removed even there is a URL. In other word, you need to create a new algorithm in your python file.

Because arcpy.GetParameterAsText, basically read texts. The parameter in the script tool is practically to filter the UI what type of your input. 

Hopefully it helps you

Cheers

0 Kudos
DonMorrison1
Occasional Contributor III

Hi Alexander - thanks for responding. But I don't quite follow your suggestion.  The file upload works perfectly. But when I click URL,  enter a URL, then Submit, I can't figure out how to get that URL string in my script. Instead of the URL, I get the string "c:\arcgisserver\directories\arcgisjobs\row_dev\devorga_gptools_gpserver\j1b86d313ca9243ef9318a28bcba24ef0\scratch\1'. I can certainly create a new algorithm in the Python file as you suggest but I'm not sure what it is supposed to do.   Can you please clarify? Thanks

0 Kudos
AlexanderDanielPratama
Esri Contributor

Pardon my misunderstood. Have you tried to fill in another URL with the method GET parameter directly that contains file. I look in Esri documentation like this image below (Geoprocessing parameter types—ArcGIS Web AppBuilder | Documentation). 

AlexanderDaniel_Pratama_0-1708906095283.png

DonMorrison1
Occasional Contributor III

Now I see where I was going wrong. I mistakenly thought the URL needed to point to a REST service, but it needs to point to a file, as shown in your image.  And this makes sense since the parameter type is DEFile. Opps.  Thanks so much Alexander helping me figure this out.

0 Kudos