ie.geologyidea.com
More

Arcpy.Clip_analysis() Automatically Affixing .shp.shp to Target Feature Class Name?

Arcpy.Clip_analysis() Automatically Affixing .shp.shp to Target Feature Class Name?


We are searching data for your request:

Forums and discussions:
Manuals and reference books:
Data from registers:
Wait the end of the search in all databases.
Upon completion, a link will appear to access the found materials.


I created a Python script that was previously working fine, but is now giving me an error when I try to use the arcpy.Clip_analysis() function in arcmaps 10.2.1. I am not adding a filetype extnsion to any of my feature class names when creating them. Previously, this worked fine. Now however i looks like ".shp" is being affixed to my feature class name twice, making the name invalid. Here is my code:

in_features = os.path.join(arcMapsAuto.pc_gdb, arcMapsAuto.merged_feature_class ) clip_features = os.path.join(arcMapsAuto.shapes_gdb, "Terminal_Polygon_Merge") out_feature_class = os.path.join(arcMapsAuto.tc_gdb, "All_Terminal_Clip") # Check to see if feature class already exists if arcpy.Exists(out_feature_class): print "All_Terminal_Clip creation: FAIL." print " --All_Terminal_Clip already exists." #return print in_features print clip_features print out_feature_class # printed out: {geodatabas}All_Terminal_Clip # Execute Clip try: arcpy.Clip_analysis(in_features, clip_features, out_feature_class) print " All_Terminal_Clip creation: SUCCESSS." except Exception as err: arcpy.AddError(err) print "All_Terminal_Clip creation: FAIL." print err # printed error: ERROR 000210: Cannot create output {geodatabase}All_Terminal_Clip.shp.shp ERROR 000354: The name contains invalid characters return

I am missing something? Is arcpy.Clip_analysis() affixing .shp.shp to my target feature class name, and is this a new issue? I swear I've used the same code before without a problem? Any ideas on how I can fix this?

{geodatabase}All_Terminal_Clip

All_Terminal_Clip creation: FAIL.

ERROR 000210: Cannot create output {geodatabase}All_Terminal_Clip.shp.shp ERROR 000354: The name contains invalid characters


As commented by @MichaelMiles-Stimson:

It looks like your path to geodatabase is not correct, try setting that as a string: out_feature_class = "c:PATHTOGEODATABASE.gdbAll_Terminal_Clip", at the moment it's {geodatabas}All_Terminal_Clip which is likely to be causing your error.


Watch the video: ArcGIS Pro: Editing - Merge, Split and Clip