Append to Feature Class

1500
5
Jump to solution
03-25-2020 11:55 AM
jaykapalczynski
Frequent Contributor

Tryng to append a selected set of features to an existing FC

So I grab a point, create a buffer in memory, select counties in that buffer, then I want to write those to a multipart feature in an existing FC...

The selectedCounties.gdb has Feature Classes "CountiesDissolved" and "Counties_appended" in it

ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000732: Target Dataset: Dataset Counties_appended does not exist or is not supported
Failed to execute (Append).

I also tried as such

arcpy.Append_management(results, "C:\Work\CountySelection\Data\SelectCounties.gdb\Counties_appended", "TEST","","")

Any thoughts?

I am also going to want to add values to the FC attributes on the append but thats the next step I guess

point = arcpy.Point(coordinateX, coordinateY)
ptGeometry = arcpy.PointGeometry(point)

# FEED THE BUFFER ANALYSIS THE POINT GEOMETRY THE DISTANCE PARAMETERS
arcpy.Buffer_analysis(ptGeometry, 'IN_MEMORY/BufferGeom', distanceMeters)

arcpy.env.workspace = "C:\Work\CountySelection\Data\SelectCounties.gdb"
arcpy.MakeFeatureLayer_management('CountiesDissolved', 'counties_lyr')

results = arcpy.SelectLayerByLocation_management('counties_lyr', 'INTERSECT', 'IN_MEMORY/BufferGeom')

arcpy.Append_management(results, "Counties_appended", "TEST","","")‍‍‍‍‍‍‍‍‍‍‍‍‍
0 Kudos
1 Solution

Accepted Solutions
jaykapalczynski
Frequent Contributor

Think I got it working

Doing this....but wanting to create that FC in memory and not writing it to a FC to only have to delete it.

Testing now

point = arcpy.Point(coordinateX, coordinateY)
ptGeometry = arcpy.PointGeometry(point)

# FEED THE BUFFER ANALYSIS THE POINT GEOMETRY THE DISTANCE PARAMETERS
arcpy.Buffer_analysis(ptGeometry, 'IN_MEMORY/BufferGeom', distanceMeters)

arcpy.env.workspace = "C:\Data\SelectCounties.gdb"

arcpy.Delete_management('chihuahua_10000plus')

arcpy.MakeFeatureLayer_management('CountiesDissolved', 'counties_lyr')

results = arcpy.SelectLayerByLocation_management('counties_lyr', 'INTERSECT', 'IN_MEMORY/BufferGeom')

# Write the selected features to a new featureclass
arcpy.CopyFeatures_management("counties_lyr", "C:\Data\SelectCounties.gdb\chihuahua_10000plus")

arcpy.MakeFeatureLayer_management('chihuahua_10000plus', 'Counties_append')

arcpy.Append_management('Counties_append', 'C:\Data\SelectCounties.gdb\CountiesDissolved_append', 'TEST','','')
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

View solution in original post

0 Kudos
5 Replies
jaykapalczynski
Frequent Contributor

 think I would have to merge or dissolve them first....the append them?

0 Kudos
jaykapalczynski
Frequent Contributor

Think I got it working..

Took the result and wrote that to the newly created FC

Then took that new FC and appended to the original FC

Testing

0 Kudos
DanPatterson_Retired
MVP Emeritus

Select Layer By Location—Data Management toolbox | Documentation 

No 'result' assignment, hence it doesn't exist

arcpy.SelectLayerByLocation_management("parcel_lyr", "have_their_center_in", 
                                       "c:/kamsack.gdb/city_limits")
0 Kudos
jaykapalczynski
Frequent Contributor

Think I got it working

Doing this....but wanting to create that FC in memory and not writing it to a FC to only have to delete it.

Testing now

point = arcpy.Point(coordinateX, coordinateY)
ptGeometry = arcpy.PointGeometry(point)

# FEED THE BUFFER ANALYSIS THE POINT GEOMETRY THE DISTANCE PARAMETERS
arcpy.Buffer_analysis(ptGeometry, 'IN_MEMORY/BufferGeom', distanceMeters)

arcpy.env.workspace = "C:\Data\SelectCounties.gdb"

arcpy.Delete_management('chihuahua_10000plus')

arcpy.MakeFeatureLayer_management('CountiesDissolved', 'counties_lyr')

results = arcpy.SelectLayerByLocation_management('counties_lyr', 'INTERSECT', 'IN_MEMORY/BufferGeom')

# Write the selected features to a new featureclass
arcpy.CopyFeatures_management("counties_lyr", "C:\Data\SelectCounties.gdb\chihuahua_10000plus")

arcpy.MakeFeatureLayer_management('chihuahua_10000plus', 'Counties_append')

arcpy.Append_management('Counties_append', 'C:\Data\SelectCounties.gdb\CountiesDissolved_append', 'TEST','','')
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
0 Kudos
jaykapalczynski
Frequent Contributor

I ended up using an INSERT CURSOR

0 Kudos