1

I've got the following script and want to run it in the ModelBuilder.

import arcpy, os
dem = r'C:\folder\dem.tif'
out_folder = r'C:\outfolder'
epsgs = range(32601,32661) + range(32701,32761)
for epsg in epsgs:
    print 'Reprojecting to epsg: ',epsg
    arcpy.ProjectRaster_management(in_raster=dem, out_raster=os.path.join(out_folder,'Reprojected_epsg_{0}.tif'.format(epsg)), 
                                  out_coor_system=arcpy.SpatialReference(epsg))

So I've changed the input and output this way,

import arcpy
import sys
import string
import os

dem = arcpy.GetParameterAsText(0)
out_folder = arcpy.GetParameterAsText(1)
epsgs = range(32601,32661) + range(32701,32761)

and loaded it into my toolbox

enter image description here

Here is the 1st problem. Did I have chosen the wrong Data Type? I want the script to save the created files into the existing folder.

enter image description here

Then I tried to write another folder to the path and the error disappeared.

Y:\Home\hoffmada\World_rivers\Verarbeitete_Daten\Flowdirection_UTM_120\flowdirection

But when I want to execute the script I got this error message.

enter image description here

So what Data Type do I have to choose to write down the new rasters into my folder I've chosen?

2

It may initially seem counter-intuitive but the location for where you want to write your outputs should be a parameter with a Direction of Input.

Your tool dialog asks the user for two inputs:

  1. a Raster Dataset
  2. a Folder location (where you want to write your outputs)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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