0

I have a model saved in ArcGIS Pro that I'm trying to publish as a web tool, but I'm struggling to create a parameter that allows users to specify the workspace location where the output feature classes should be saved each time the tool runs. The model produces several temporary feature classes and one large final feature class.

I've tried using the 'workspace' and 'folder' variables, but when I go to publish the model and configure the parameters, these fields are listed as constants (the value is fixed as whatever was entered during the most recent execution of the model in ModelBuilder). I also tried creating a string variable and then copy and pasting the path of the geodatabase where I wanted the output saved, and this worked successfully in ModelBuilder but when I published it and ran it as a tool, it failed because of a 'bad syntax' error.

What else should I try so that the web tool will accept an output path as a parameter and write output to that location?

1
  • Defining an output workspace makes sense for a local GP tool, but not for a web GP service, the server doesn't have access to those paths. From the documentation: "You can write output paths to almost any location when creating models. When the model tool is shared as a web tool, these output paths are updated so it can run on the server."
    – user2856
    Commented Aug 7, 2023 at 21:16

1 Answer 1

2

The short answer to your question is: You don't allow the user to supply a workspace parameter when creating a web tool (geoprocessing service). The GP Server framework handles all outputs for you (saving them to a good location and passing them back to the client).

Inside Modelbuilder you'll want to do 2 things:

  • Write outputs to %scratchGDB%/myoutput (or %scratchFolder%/myshp.shp)
  • Make your final outputs, the ones you want to return to the user a model parameter (right click, and mark it. The bubble will get tagged with a "P")

When you publish this model to server, the framework will properly write outputs to server accessible locations and when the task finishes, pass anything marked with a "P" back to the client. There is also the added benefit of server cleaning up those intermediate outputs (so you don't have too).

To briefly explain the workspace parameters being marked as constants: This particular parameter type is not supported in geoprocessing services. Any unsupported type gets converted to constant (or hardcoded). Generally speaking, allowing a user to set the workspace or folder path is the wrong approach when developing geoprocessing services.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.