3

I have a polygon with many columns. I want to convert into raster. I could do it one by one. But I want to iterate for each column of the polygon by model builder or any other way. Here you can see the attached table of the polygon. For example I want to make one raster for Abst85, another one for Abst91, .....Then save them in separate

Screenshot

  • Please take the tour. Your question is not very clear. – John Powell Dec 18 '15 at 12:15
  • Do the values in each column identify a set of different polygons or do they identify the same? Suggest you update your question with a few images? – Hornbydd Dec 18 '15 at 14:15
  • i have edited my question , could you please check again – Syed Dec 18 '15 at 14:35
1

This is not something that can be easily automated in model builder as there is no iterator for fields within a dataset.

You can achieve what you are asking with the following python script.

import arcpy

# Input layer
fc = r"C:\Scratch\sdr_subnational_data_dhs_2008.shp"

# Create a list of field names
fieldList = [f.name for f in arcpy.ListFields(fc)]

# Remove any non numeric or system fields
fieldList.remove('FID')
fieldList.remove('Shape')

# Set output workspace and cellsize
arcpy.env.workspace = r"C:\scratch"
arcpy.env.overwriteOutput = True
cellsize = 0.018

# Main loop
for fn in fieldList:
    rn = "ras_" + fn + ".tif"
    arcpy.FeatureToRaster_conversion(fc,fn,rn,cellsize)

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.