AnsweredAssumed Answered

Why can arcpy.Project_management not create output?

Question asked by jbridwell_Dewberry on Nov 3, 2019

I have 2 feature datasets in a .gdb (CNMS_Inventory and CNMS_Inventory_Albers). I set the dataset for CNMS_Inventory to 4269(NAD83) when I created it and it contains a feature class called S_Studies_County_Intersect_Merged. My goal is to basically change the projection of S_Studies_County_Intersect_Merged to North America Albers Equal Area Conic and write the output to the dataset (in the same gdb) called CNMS_Inventory_Albers (which was set to North America Albers Equal Area Conic). I first tried just using CopyFeatures but it threw an error:

cnms_inventory = os.path.join(all_regions_gdb, "CNMS_Inventory")
new_studs = os.path.join(cnms_inventory,"S_Studies_County_Intersect_Merged")
albers_ds = os.path.join(all_regions_gdb, "CNMS_Inventory_Albers")
albers_studs = os.path.join(albers_ds, "S_Studies_Ln_Merge_Albers")
albers_unmapped = os.path.join(albers_ds, "S_Unmapped_Ln_Merge_Albers")
arcpy.CopyFeatures_management(new_studs, albers_studs)

Error Traceback:

ExecuteErrorTraceback (most recent call last) in () 2 albers_studs = os.path.join(albers_ds, "S_Studies_Ln_Merge_Albers") 3 albers_unmapped = os.path.join(albers_ds, "S_Unmapped_Ln_Merge_Albers") ----> 4 arcpy.CopyFeatures_management(new_studs, albers_studs) C:\Program Files (x86)\ArcGIS\Desktop10.5\arcpy\arcpy\ in CopyFeatures(in_features, out_feature_class, config_keyword, spatial_grid_1, spatial_grid_2, spatial_grid_3) 2584 return retval 2585 except Exception as e: -> 2586 raise e 2587 2588 @gptooldoc('DeleteFeatures_management', None) ExecuteError: ERROR 000224: Cannot insert features Failed to execute (CopyFeatures).


I figured that this maybe due to the fact that the output feature, new_studs (S_Studies_Ln_Merge_Albers) needs to be projected into Albers first (I was thinking I maybe cannot just write a NAD83 projected feature to an Albers projected dataset). So I tried the following which gives be another error:


sr = arcpy.SpatialReference(4269)
projection = arcpy.SpatialReference('North America Albers Equal Area Conic')
arcpy.Project_management(new_studs, albers_studs, out_coor_system=projection, in_coor_system=coord_sys)

ExecuteError: ERROR 000210: Cannot create output T:\CCSI\TECH\FEMA\Datasets\CNMS\FY18Q3\CNMS_AllRegions_FY18Q3.gdb\S_Studies_Ln_Merge_Albers Failed to execute (Project).


Looking at this error, it seems like Project is trying to write my output to "T:\CCSI\TECH\FEMA\Datasets\CNMS\FY18Q3\CNMS_AllRegions_FY18Q3.gdb\S_Studies_Ln_Merge_Albers" instead of 

"T:\\CCSI\\TECH\\FEMA\\Datasets\\CNMS\\FY18Q3\\CNMS_AllRegions_FY18Q3.gdb\\CNMS_Inventory_Albers\\S_Studies_Ln_Merge_Albers", which basically leaves out the feature dataset CNMS_Inventory_Albers. Can anyone see where I am going wrong here or how I can fix this?