Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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())
share|improve this question

2 Answers 2

up vote 5 down vote accepted

Your output dataset has the same name as your input dataset. Try setting a different workspace for the output, like: outWorkspace = "C:\\users\\data\\shapefile_roads_projected"

share|improve this answer
    
Ahhh of course. That did the trick! –  Paul Edwards 22 hours ago
    
@PaulEdwards Please consider accepting an answer by selecting the green checkmark if you found an answer. –  Aaron 22 hours ago

Well, the error message is pretty straight forward:

ERROR 000670: output Output Dataset or Feature Class is same as input Input Dataset or Feature Class Failed to execute (Project).

The infc and outfc variables both point to the same feature class.

One easy fix would be to output into a different folder.

So, create a new folder called "projected" within the "shapefile_roads" folder, and change outWorkspace to:

outWorkspace = "C:\\users\\data\\shapefile_roads\\projected"
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.