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","","")
Solved! Go to Solution.
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','','')
think I would have to merge or dissolve them first....the append them?
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
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")
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','','')
I ended up using an INSERT CURSOR