I plan to run a scheduled server job on a feature class in an Oracle 18c/10.7.1 geodatabase.

The job would:

  1. Truncate the rows in an existing feature class
  2. Generate new rows from a geoprocessing tool (FeatureVerticesToPoints / midpoints)
  3. Insert/append the geoprocessing rows into the feature class

Note: I would like to do this without needing to temporarily store any sort of intermediate results in a temporary feature class/GDB.

I've gotten part-way there:

import arcpy
conn = "Database Connections\\DEV.sde\\"
input_lines = "OWNER.ROAD"

arcpy.TruncateTable_management(conn + existing_fc)
arcpy.FeatureVerticesToPoints_management(conn + input_lines, conn + existing_fc, "MID")

#arcpy.Append_management(, , "TEST", "", "")


I'm not sure how to use FeatureVerticesToPoints_management as the input in the append process.

Is there a way to append/insert geoprocessing results into an existing feature class using ArcPy?

2 Answers 2


You can't* do this using FeatureVerticesToPoints without writing to an intermediate feature class.

You have two options:

  1. Use FeatureVerticesToPoints and write to the in_memory workspace, then append:

    arcpy.management.FeatureVerticesToPoints(input_lines,  "in_memory\\output_points", "ALL")
    arcpy.management.Append("in_memory\\output_points", existing_fc, "TEST")
  2. Use a SearchCursor to get the vertices, convert to points then an InsertCursor to populate the output:

    with arcpy.da.SearchCursor(input_lines, ['SHAPE@', '*']) as s_rows:
        with arcpy.da.InsertCursor(existing_fc, ['SHAPE@', '*']) as i_rows:
            for row in s_rows:
                line = row[0]
                for i in range(line.partCount):
                    points = line.getPart(i)
                    for point in points:
                        i_rows.insertRow([point] + list(row[1:]))

* You can of course overwrite existing_fc but that's not a useful option in most enterprise GDBs.


I've built on @user2856's answer:

  1. Loop through a list that has 3 rows. Each row has an input FC, target FC, and an ID field.
  2. For each row in the list:
    • Truncate the target FC
    • Populate the target FC with midpoints from the input FC (target FC fields are: SHAPE, MIDPOINT_X, and MIDPOINT_Y)
    • Populate the ID field in the target FC

Caution! The target FCs will get truncated! All records in the target FCs will be deleted.

import arcpy
conn = "Database Connections\\<YOUR CONNECTION.sde>\\"

#This script only works for polyline feature classes (not polygons or points).
#Caution! The target FCs will get truncated! All records in the target FCs will be deleted.

#       INPUT FC               TARGET FC                     ID FIELD (for both the input FC and the target FC)    
lstFC = [\
        ["<OWNER>.<SEWER>"   , "<OWNER>.S_SEWER_MIDPOINT"  , "SEWER_ID" ],\
        ["<OWNER>.<ROAD>"    , "<OWNER>.S_ROAD_MIDPOINT"   , "ROAD_ID"  ],\

def ReloadMidpoints():
    for fc in lstFC:
        inputFC  = conn + (fc)[0]
        targetFC = conn + (fc)[1]
        idField  = (fc)[2]

        print "<" + targetFC + "> has been truncated."

        with arcpy.da.SearchCursor(inputFC, ['SHAPE@', idField]) as s_rows:
            with arcpy.da.InsertCursor(targetFC, ['SHAPE@', idField, "MIDPOINT_X","MIDPOINT_Y"]) as i_rows:
                for row in s_rows:
                    Midpoint = row[0].positionAlongLine(0.50,True).firstPoint
                    rowVals = [(Midpoint.X,Midpoint.Y),s_rows[1],Midpoint.X,Midpoint.Y]

        print "<" + targetFC + "> has been reloaded with midpoints that were generated from <" + (inputFC) + ">."
        print ""

print "Complete."

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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