2

I wrote a small toolbox that calculates the slope in degrees of a given .tif file, stores the ouput to a local folder on my computer and generates 2 by 2 tiles. The toolbox works fine, the publishing as WPS to ArcGis Server worked fine too. But when I try to execute the WPS in ArcMap several errors occur.

The first:

I intended to create a folder structure for the output tiles that every "zoomlevel" has it's own folder for better accessibility (folder 1 = 4 tiles, folder 2 = 16 tiles etc.):

import os, sys
import arcpy

####
## Environment Settings ArcPy
####

file_in = arcpy.GetParameterAsText(0)
path_out = arcpy.GetParameterAsText(1)


fname = file_in.rsplit('\\', 1)[1]

###
## Calculate Slope
###

arcpy.env.workspace = path_out
fout = path_out + '\\'+ fname[0:3] + '_slope.tif'
slope = arcpy.Slope_3d(file_in, fout, "DEGREE")
arcpy.env.overwriteOutput = True
files = arcpy.ListFiles('*.tif')

###
## Tiling 2 by 2
###

for i in range(1,4):
    for fi in files:
            fout = str(fi)[:-4] + '_'
            tiles_path = "%s\\%s\\" %(path_in, i)
            if not arcpy.Exists(tiles_path):
                arcpy.CreateFolder_management(path_in, "%s" % i)
            arcpy.SplitRaster_management(fi, tiles_path, fout, "NUMBER_OF_TILES", "TIFF", "BILINEAR", "2 2", "#", "4", "PIXELS", "#", "#")
    arcpy.env.workspace = tiles_path
    files = arcpy.ListFiles('*.tif')

But the following error occured.

Traceback (most recent call last): File "C:\arcgisserver\directories\arcgissystem\arcgisinput\GeoTools\Slope3.GPServer\extracted\v101\my_toolboxes\Slope_Steepness_v01.py", line 41, in arcpy.CreateFolder_management(path_out, "tiles") File "c:\program files\arcgis\server\arcpy\arcpy\management.py", line 16613, in CreateFolder raise e ExecuteError: Failed to execute. Parameters are not valid. ERROR 000732: Output Folder: Dataset C:\test\1_proc_data\tiles does not exist or is not supported Failed to execute (CreateFolder)

So I gave up on the folder structure and rewrote the script to store everyting into one folder, I already created. Again this worked fine when I was using the Toolbox in ArcMap. But after publishing the Service as WPS, the following error occured:

The second:

import os, sys
import arcpy

####
## Environment Settings ArcPy
####

file_in = arcpy.GetParameterAsText(0)
path_out = arcpy.GetParameterAsText(1)


fname = file_in.rsplit('\\', 1)[1]

###
## Calculate Slope
###

arcpy.env.workspace = path_out
fout = path_out + '\\'+ fname[0:3] + '_slope.tif'
slope = arcpy.Slope_3d(file_in, fout, "DEGREE")
arcpy.env.overwriteOutput = True
files = arcpy.ListFiles('*.tif')

###
## Tiling 2 by 2
###

fout = fname[:-4] + '_'

for i in range(1,4):
    for fi in files:
            fout = str(fi)[:-4] + '_'
            arcpy.SplitRaster_management(fi, path_out, fout, "NUMBER_OF_TILES", "TIFF", "BILINEAR", "2 2", "#", "4", "PIXELS", "#", "#")
    arcpy.env.workspace = path_out
    files = arcpy.ListFiles('*.tif')

Traceback (most recent call last): File "C:\arcgisserver\directories\arcgissystem\arcgisinput\GeoTools\Slope3.GPServer\extracted\v101\my_toolboxes\Slope_Steepness_v01.py", line 45, in slope = arcpy.Slope_3d(file_in, fout, "DEGREE") File "c:\program files\arcgis\server\arcpy\arcpy\ddd.py", line 4117, in Slope raise e ExecuteError: ERROR 000875: Output raster: C:\Users\stankowski\ownCloud\Project_v01\1_proc_data\tiles\srt_slope.tif workspace is an invalid output workspace.

I checked the spelling, the use of characters and the length of the output file. I can not make sense of this. The Analysis Tool doesn't find any bugs before publishing it to the server. The only reason I can think of is that there are issues accessing local folders via WPS. Are there any ways to resolve this? I enabled upload to the Server in the Service Definiton File.

2

Change the rights of the folder you are writing too. I think the arcgis user must have write and read rights.

Another idea is to register to folder with the files and don't copy the files to the server.

  • I tried editing the user rights and ended up - despite all security advice - giving writing permission to my whole C:/ drive. It didnt work. The ultimate goal is to use the WPS in a WebApp. Is there another alternative to registering the folder since only a few people can use the service when it is registration only? – ohnoinkimono Jun 28 '16 at 13:51

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