I am trying to reproject multiple shapefiles in a folder. When I run my program this is the error I am getting:
line 8221, in Project
raise e
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 checked my code and I’m not seeing what Im doing wrong. What could be the issue here?
# Import system modules
import arcpy
import os
# Set environment settings
arcpy.env.workspace = "C:\users\data\shapefile_roads"
arcpy.env.overwriteOutput = True
outWorkspace = "C:\users\data\shapefile_roads"
for infc in arcpy.ListFeatureClasses():
# Determine if the input has a defined coordinate system, can't project it if it does not
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)
# Set output coordinate system
outCS = arcpy.SpatialReference('WGS 1984')
# run project tool
arcpy.Project_management(infc, outfc, outCS)
# check messages
print(arcpy.GetMessages())