I am running a model which I created with ModelBuilder at 10.3. The model is supposed to make a selection by attribute on a feature layer, and use that layer to clip a raster. The model is working fine when I run it, however if I try to use it in batch mode it gives unexpected results: I have many files with the same extent and content as the first line of the loop (of the batch).
The parameters of my models are:
- the input feature layer against which a selection is specified
- the input raster (.BIL)to be clipped with the selected feature
- the SQL expression for the selection (of the type "FIELD" = 'value')
- the output folder and filename (with .BIL extension)
Basically, in the batch window the feature and raster parameters are fixed, I am only changing the SQL expression to point a different 'value', so that the output raster is clipped on different areas each time, and the filename name of the output.
Below is my model:
Answer
Reading the output message of the geoprocessing tool in batch, I realized the batch is not looping as I expected. It seems it loops at each tool in the model for each line in the batch, rather than performing the entire model once and then passing the next line and so on.
So, it was sufficient to append an "%n%" to the first output variable ("judete_100_L" to become "judete_100_L0", then "judete_100_L1" and so on), not to let the batch process overwriting the output of each loop with the one after keeping only the only one at the end.
http://help.arcgis.com/EN/ARCGISDESKTOP/10.0/HELP/index.html#//002w0000001w000000
To clarify this behaviour, I attach the output message of the model run in batch.
Executing: SelectAndClipRomania \PATH\TO\Population\ROMANIA_POPULATION_MAP.bil \PATH\TO\Vector\shp\judete_100.shp ""Judet" = 'ALBA'" \PATH\TO\output_folder\MBoutput_01.bil
Start Time: Fri Jan 29 09:36:10 2016
Executing (Make Feature Layer): MakeFeatureLayer \PATH\TO\Vector\shp\judete_100.shp judete_100_Layer0 # # "FID FID VISIBLE NONE;Shape Shape VISIBLE NONE;Judet Judet VISIBLE NONE;Siruta_har Siruta_har VISIBLE NONE;Corectat Corectat VISIBLE NONE;Shape_leng Shape_leng VISIBLE NONE;Shape_area Shape_area VISIBLE NONE"
Start Time: Fri Jan 29 09:36:11 2016
Executing (Make Feature Layer): MakeFeatureLayer \PATH\TO\Vector\shp\judete_100.shp judete_100_Layer1 # # "FID FID VISIBLE NONE;Shape Shape VISIBLE NONE;Judet Judet VISIBLE NONE;Siruta_har Siruta_har VISIBLE NONE;Corectat Corectat VISIBLE NONE;Shape_leng Shape_leng VISIBLE NONE;Shape_area Shape_area VISIBLE NONE"
Succeeded at Fri Jan 29 09:36:11 2016 (Elapsed Time: 0,22 seconds)
Executing (Select Layer By Attribute (2)): SelectLayerByAttribute judete_100_Layer0 NEW_SELECTION ""Judet" = 'ALBA'"
Start Time: Fri Jan 29 09:36:11 2016
Executing (Select Layer By Attribute (2)): SelectLayerByAttribute judete_100_Layer1 NEW_SELECTION ""Judet" = 'ARAD'"
Succeeded at Fri Jan 29 09:36:11 2016 (Elapsed Time: 0,03 seconds)
Executing (Clip): Clip \PATH\TO\ROMANIA_POPULATION_MAP.bil "-20586,2072725614 4830748,2852006 712578,171046345 5345773,0034133" \PATH\TO\output_folder\MBoutput_01.bil judete_100_Layer0 2147483647 NONE NO_MAINTAIN_EXTENT
Start Time: Fri Jan 29 09:36:11 2016
Executing (Clip): Clip \PATH\TO\ROMANIA_POPULATION_MAP.bil "-20586,2072725614 4830748,2852006 712578,171046345 5345773,0034133" \PATH\TO\output_folder\MBoutput_02.bil judete_100_Layer1 2147483647 NONE NO_MAINTAIN_EXTENT
Succeeded at Fri Jan 29 09:36:27 2016 (Elapsed Time: 15,73 seconds)
Executing (Select Layer By Attribute (3)): SelectLayerByAttribute judete_100_Layer0 CLEAR_SELECTION #
Start Time: Fri Jan 29 09:36:27 2016
Executing (Select Layer By Attribute (3)): SelectLayerByAttribute judete_100_Layer1 CLEAR_SELECTION #
Succeeded at Fri Jan 29 09:36:27 2016 (Elapsed Time: 0,02 seconds)
Succeeded at Fri Jan 29 09:36:27 2016 (Elapsed Time: 17,67 seconds)
No comments:
Post a Comment