I'm trying to reproject shapefiles and I keep getting stuck with this error
ExecuteError: ERROR 000208: Error creating output feature class
Failed to execute (Project).
https://imgur.com/a/2cfXVox
Here is all of my code.
import arcpy
from arcpy import env
env.overwriteOutput = True
env.workspace = r"D:\GEOG3530\Ex4\DataEX4"
# List feature classes and their coordinate systems in given folder
folderFiles = arcpy.ListFeatureClasses()
for fc in folderFiles:
fcdesc = arcpy.Describe(fc)
print(str(fcdesc.basename) + " is in " + str(fcdesc.spatialReference.name))
for fc in folderFiles:
fcdesc = arcpy.Describe(fc)
infc = fc
print(infc)
outfc = "D:/GEOG3530/Ex4/Ex4proj/Ex4proj.gdb/Results/" + fcdesc.basename
print(outfc)
sref = arcpy.SpatialReference('USA Contiguous Lambert Conformal Conic')
print(sref)
arcpy.management.Project(infc, outfc, sref)list feature class code block output:
CA_Cities_Selection is in GCS_WGS_1984
CA_Earthquakes is in GCS_WGS_1984
CA_Outline is in GCS_WGS_1984
for loop output before error occurs:
CA_Cities_Selection.shp
/GEOG3530/Ex4/Ex4proj/Ex4proj.gdb/Results/CA_Cities_Selection
<geoprocessing spatial reference object object at 0x000001BFCC5A3E70>
And here is the full error message
---------------------------------------------------------------------------
ExecuteError Traceback (most recent call last)
Cell In[27], line 9
7 sref = arcpy.SpatialReference('USA Contiguous Lambert Conformal Conic')
8 print(sref)
----> 9 arcpy.management.Project(infc, outfc, sref)
File ~\AppData\Local\Programs\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py:20421, in Project(in_dataset, out_dataset, out_coor_system, transform_method, in_coor_system, preserve_shape, max_deviation, vertical)
20419 return retval
20420 except Exception as e:
> 20421 raise e
File ~\AppData\Local\Programs\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py:20403, in Project(in_dataset, out_dataset, out_coor_system, transform_method, in_coor_system, preserve_shape, max_deviation, vertical)
20399 from arcpy.arcobjects.arcobjectconversion import convertArcObjectToPythonObject
20401 try:
20402 retval = convertArcObjectToPythonObject(
> 20403 gp.Project_management(
20404 *gp_fixargs(
20405 (
20406 in_dataset,
20407 out_dataset,
20408 out_coor_system,
20409 transform_method,
20410 in_coor_system,
20411 preserve_shape,
20412 max_deviation,
20413 vertical,
20414 ),
20415 True,
20416 )
20417 )
20418 )
20419 return retval
20420 except Exception as e:
File ~\AppData\Local\Programs\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py:532, in Geoprocessor.__getattr__.<locals>.<lambda>(*args)
530 val = getattr(self._gp, attr)
531 if callable(val):
--> 532 return lambda *args: val(*gp_fixargs(args, True))
533 else:
534 return convertArcObjectToPythonObject(val)
ExecuteError: ERROR 000208: Error creating output feature class
Failed to execute (Project).I initially thought the problem was backslashes in the file path, but I switched those to forward slashes and it didn't fix it. I don't really understand how to read the error messages yet because I'm new to coding completely.
At one point I also go this error.
ExecuteError: 000354: The name contains invalid characters.
I'm not really sure what I'm missing here. I appreciate all help, thanks.