[GIS] Geoprocessing service saved data to scratch gdb

arcgis-serverfile-geodatabasegeoprocessing-servicemodelbuilder

I created and published a geoprocessing service from a toolbox. It works with a file geodatabase on my local drive. When run as a tool in ModelBuilder, it worked well and wrote data into the file geodatabase perfectly. However, when I published it as geoprocessing service and triggered it via REST service, it wrote data into the scratch.gdb in the job directory on the ArcGIS Server directories.

How can I configure the tool/model, or service or arcgis server to make it work with the original file geodatabase instead of the scratch file geodatabase?

Best Answer

To avoid situations like these, I rework my toolbox until I am satisfied with it, copy it to a shared folder on the AGS machine and publish the service from there, making sure that model's scratch gdb is referenced in the environment settings correctly.

You should also register the gdb with ArcGIS Server. Anecdotally, I've found this process to be hit-and-miss; half of my gdbs get copied over to the local Server directories because "it's not registered", even though it is. This should not be such a big problem though.

If you would like the user to input the file gdb to be used, add that as a model parameter and make sure all your internal tools point to that variable so that all outputs will be written there.

Related Question