POST
|
Hi Gary, I finally used another solution as MultiValue is not supported for geoprocessing output parameter. Sorry, maybe Bruce's solution works, I didn't try it.
... View more
06-22-2011
04:12 AM
|
0
|
0
|
255
|
POST
|
Hello, how can I transfer objects of a Python list into a MultiValue output parameter? The code I've written so far (below) put a complete list of layers objects in one row of the MultiValue output parameter but I'd like that each layer to be defined in one particular row:
listOfClippedOutputLayers = []
listInputFC = allInputFC.split(";")
for inFC in listInputFC:
(inPath, inFC) = os.path.split(inFC)
# [...] Clipping
layer = arcpy.MakeFeatureLayer_management(clippedFC, clippedFCLayer)
listOfClippedOutputLayers.append(layer)
arcpy.SetParameter(3, listOfClippedOutputLayers)
Does anyone know how to do this "transfer"? Thanks for your help! Marc
... View more
04-21-2011
03:13 AM
|
0
|
4
|
2412
|
POST
|
Hello, thank you for your answer! Does anyone know if it's possible to define the parameter when saving a layer object to a file (like in the code below)?
[...]
layer = arcpy.MakeFeatureLayer_management(clippedFC, clippedFCLayer)
layer.description = "N/A"
arcpy.SaveToLayerFile_management(layer, clippedFCLayer, "RELATIVE")
[...]
In fact, in my case, I'd like to set the description to "N/A" for all .lyr files in a given directory (either when creating the layer files or after they have been created) for packing them. Marc
... View more
04-19-2011
03:17 AM
|
0
|
0
|
375
|
POST
|
Hello, I need to make a package of layers in a Python script. The "PackageLayer" tool required that the layers have a description in order to run, but the layers I have to pack are created and saved on disk just before the packaging. Thus, I can't set a description manually. There is a way to set it directly in Python? (or to avoid it as I don't need any description) Thanks for your help Marc
... View more
04-18-2011
04:50 AM
|
0
|
7
|
921
|
POST
|
[Resolved] If it can help someone:
h = int(arcpy.GetParameterAsText(0))
if h >= 6 and h < 12:
arcpy.SetParameterAsText(1, "Raster_Morning")
elif h >= 12 and h < 18:
arcpy.SetParameterAsText(1, "Raster_Afternoon")
elif h >= 18 and h < 23:
arcpy.SetParameterAsText(1, "Raster_Evening")
else:
arcpy.SetParameterAsText(1, "Raster_Night")
And don't forget to check if you have to put the output parameter type as "derived" in the parameter proprieties. I'm interested in any better (faster?) solution, though... Happy arcgising Marc
... View more
03-08-2011
12:00 AM
|
0
|
0
|
136
|
POST
|
Hi everyone, I'm working on a simple model (see picture attached) that, basically, takes a location and an hour as inputs and deliver a IDW predicted value (e.g. 2375.54) as output based on the cell values of rasters stored in a geodatabase. There are four rasters stored, one for each period of the day (morning, afternoon, evening and night). I added a Python script aimed to change the name of the raster to use by the model tools according to the hour given in parameter. For example if hour = 7 the tools should use the "Morning" raster to make the prediction. If hour = 15 = 3pm, it should use the afternoon raster and so on. The model works fine if I set all the input and output parameters manually, but I can't figure out how to change dynamically the name of the raster the model has to work with. What would be the best way to switch dynamically between rasters in this kind of model? Thanks for any help or suggestion.. Marc
... View more
03-07-2011
05:00 AM
|
0
|
1
|
242
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|