Feature to raster, loop for model builder

534
5
02-21-2013 07:07 AM
MarceloOyuela
New Contributor III
Hello,

I'm trying to make a model for feature to raster.

The feature has 12 columns named for each month of the year. The values ??????for each month are precipitation amount.

I want to convert the features to raster using a  model but can not find the way to make it automatic. The result would be 12 rasters representing precipitation for the month selected.

My problem its: the "field" parameter in the feature to raster tool, how can i use iterator for columun or  theres another way?

Thanks for the help.


Marcelo Oyuela
0 Kudos
5 Replies
JakeSkinner
Esri Esteemed Contributor
Hi Marcelo,

You could accomplish this using python.  Here is an example:

import arcpy

fc = r"C:\raster\polygon.shp"

list = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]

for month in list:
    arcpy.FeatureToRaster_conversion(fc, month, r"C:\raster\precipitation_" + month + ".tif")
0 Kudos
MarceloOyuela
New Contributor III
Hi Marcelo,

You could accomplish this using python.  Here is an example:

import arcpy

fc = r"C:\raster\polygon.shp"

list = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]

for month in list:
    arcpy.FeatureToRaster_conversion(fc, month, r"C:\raster\precipitation_" + month + ".tif")



Thank you very much, work very good.

Question: can i do this as a model in model builder?.

Thank you again
0 Kudos
JakeSkinner
Esri Esteemed Contributor
Yes, you can actually add a python script to a model.
0 Kudos
MarceloOyuela
New Contributor III
ok, But, I want to know how to make a model that can do the same process. What iterator type should I use?

Thanks
0 Kudos
JakeSkinner
Esri Esteemed Contributor
I don't believe this will be possible without writing a script.
0 Kudos