Hi, I'm looking for a way of copy paste points from one layer to another, just by using python commands in Arcgis pro.
Solved! Go to Solution.
Something like below but It might just be easier to use the Use append tool to append your selected features including all attributes.
import arcpy
from arcpy import env
fc1 = "" #Feature class to copy from
fc2 = "" #feature class to copy to
arcpy.env.workspace = "" #Workspace "C:/Temp"
arcpy.env.overwriteOutput = True
# Start an edit session. Must provide the worksapce.
edit = arcpy.da.Editor(arcpy.env.workspace)
# Edit session is started without an undo/redo stack for versioned data
# (for second argument, use False for unversioned data)
edit.startEditing(True)
# Start an edit operation
edit.startOperation()
arcpy.Append_management(fc1, fc2, "NO_TEST")
# Stop the edit operation.
edit.stopOperation()
# Stop the edit session and save the changes
edit.stopEditing(True)
arcpy.RefreshActiveView()
Reading geometries—ArcPy Get Started | Documentation
Writing geometries—ArcPy Get Started | Documentation
or you can use tools in arctoolbox, eg.
Copy tool and Append tool
Can you elaborate a little more on what you are trying to accomplish, are you trying to copy all the points from one feature class to another or just copy the selected ones or ones with a certain attribute?
I want to copy all the points from one feature layer to another base feature layer. Both feature layers have the same attributes.
Append—Data Management toolbox | Documentation to an existing file
Merge—Data Management toolbox | Documentation to a new file
Something like below but It might just be easier to use the Use append tool to append your selected features including all attributes.
import arcpy
from arcpy import env
fc1 = "" #Feature class to copy from
fc2 = "" #feature class to copy to
arcpy.env.workspace = "" #Workspace "C:/Temp"
arcpy.env.overwriteOutput = True
# Start an edit session. Must provide the worksapce.
edit = arcpy.da.Editor(arcpy.env.workspace)
# Edit session is started without an undo/redo stack for versioned data
# (for second argument, use False for unversioned data)
edit.startEditing(True)
# Start an edit operation
edit.startOperation()
arcpy.Append_management(fc1, fc2, "NO_TEST")
# Stop the edit operation.
edit.stopOperation()
# Stop the edit session and save the changes
edit.stopEditing(True)
arcpy.RefreshActiveView()
In fact, you indicated that the attributes are the same, which suggests that the fields are the same, so the code sample is much easier
import arcpy
arcpy.env.workspace = "C:/path_to_your/data.gdb"
arcpy.Append_management(["featureclass1", "featureclass2"], "TEST")