I am new to python and need help. Looked for my answer but don’t know if I am even using the correct terminology.
I have a model in which I iterated through rows and performed a set of processes on each. For example a feature class with 10 features and on each of the 10 features I wanted to create an individual feature class….or… for each row create a raster based on the field (e.g.) ID. I am trying to turn this to python due to a host of reasons.
I am using 10.1 and the error is ocuring at line 40 “FeatureClassToFeatureClass”
I believe that it is failing due to my improper use of ‘row” as the input.
Here is what I have so far, but I cannot get it to work
# Import arcpy module
print "Starting...."
import arcpy
from arcpy import env
# Check out any necessary licenses
arcpy.CheckOutExtension("spatial")
env.overwriteOutput = True
selectingfeatures = "\\silver\clients\trans1.shp"
Trans1_shp = "\\silver\clients\trans1.shp"
basecldem = "\\silver\clients\basecldem"
TEMP = "\\silver\clients\TEMP"
Zone3_shp = "\\silver\clients\Zone2.shp"
transarea = "\\silver\clients\transarea"
RegionGRP = "\\silver\clients\regiongrp"
ZonalMean = "\\silver\clients\zonalmean"
ZoneArea = "\\silver\clients\zonearea"
Transition__n_ = "\\silver\clients\transition_%n%"
I_trans1 = "I_trans1_FID"
selectingLayer = arcpy.MakeFeatureLayer_management(selectingfeatures)
rows = arcpy.SearchCursor(selectingLayer)
#cursor = arcpy.SearchCursor(fc)
#row = cursor.next()
#while row:
# print(row.getValue(field))
for row in rows:
arcpy.FeatureClassToFeatureClass_conversion(row, TEMP, "Zone2.shp", "", "ID "ID" true true false 4 Short 0 4 ,First,#,\\silver\clients\Projects\P696\8_BaseMine\Processing\TEMP\trans1.shp,ID,-1,-1", "")
print "Finished PFC 2 FC...."
# Process: Polygon to Raster
arcpy.PolygonToRaster_conversion(Zone3_shp, "ID", ZoneArea, "CELL_CENTER", "NONE", "1")
print "Finished Polygon to Raster...."
# Process: Extract by Mask
arcpy.gp.ExtractByMask_sa(basecldem, Zone3_shp, transarea)
print "Extract by Mask...."
# Process: Region Group
arcpy.gp.RegionGroup_sa(ZoneArea, RegionGRP, "FOUR", "WITHIN", "ADD_LINK", "")
print "Finished Region Group...."
# Process: Zonal Statistics
arcpy.gp.ZonalStatistics_sa(RegionGRP, "VALUE", transarea, ZonalMean, "MEAN", "DATA")
print "Finished Zonal Statistics...."
# Process: Raster Calculator
arcpy.gp.RasterCalculator_sa("If( "%basecldem%" > ( 0.5 + "%ZonalMean%" ), 0, 1 )", Transition__n_)
print "Finished Raster Calcualtor"
#row = cursor.next()