I want to project certain vectors in my folder so I wrote the following code. It gives me error message:
File "F:/soil/python/code-project", line 34, in <module>
arcpy.Project_management(infc, outfc, outCS)
File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\management.py", line 8221, in Project
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000670: output Output Dataset or Feature Class is same as input Input Dataset or Feature Class
Failed to execute (Project).
I'm pretty sure my input and output workspace is not the same. Here's the code:
import arcpy import os arcpy.env.workspace = "F:/soil/python" arcpy.env.overwriteOutput = True outWorkspace = "D:/soil/project" feature_classes =  outCS = arcpy.SpatialReference() outCS.factoryCode = 3174 outCS.create() walk = arcpy.da.Walk(arcpy.env.workspace, datatype="FeatureClass", type="Polygon") for dirpath, dirnames, filenames in walk: if "Subbasin" in filenames: filenames.remove('Subbasin') for filename in filenames: feature_classes.append(os.path.join(dirpath, filename)) print feature_classes for infc in feature_classes: dsc = arcpy.Describe(infc) if dsc.spatialReference.Name == "Unknown": print('skipped this fc due to undefined coordinate system: ' + infc) else: # Determine the new output feature class path and name outfc = os.path.join(outWorkspace, infc) # project data arcpy.Project_management(infc, outfc, outCS)
Thanks for any help!!!