1

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 through 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)

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\management.py 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?

1
  • 1
    Try exiting out of the python/arcpy session and/or any ArcGIS applications (Map, Catalog, etc.). The error 000210 can happen when there's a lock. Also print out the value of albers_studs to verify it's going where you expect, although it looks correct from the lines of code above.
    – SMiller
    Nov 4, 2019 at 16:08

1 Answer 1

2

I think the issue with your Copy Features tool is that whilst you are setting up the input and output featureclass locations you don't appear to be explicitly stating what the coordinate system is for the output (which must match the Feature Dataset). You would do this by setting the environment setting. If you study the Environments section of the Help file for the Copy Features tool you will see that it honours Output Coordinate System. Ensure that is set before you call Copy Features and then the tool will project the data as you copy it. It's a nifty setting which avoids the need for calling a Project tool.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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