Appending features using two feature classes in "memory" using Python in ArcGIS Pro

479
2
Jump to solution
07-05-2021 01:47 AM
MattHowe
New Contributor III

I have two feature classes that I have created in the "memory" workspace, one of which contains one polygon feature that I would like to append to the other. The schemas of both feature classes differ. 

When I run the append geoprocessing tool using a script, and in the immediate Python window, the tool executes fine but the feature isn't appended to the target feature class. Is it possible to append features between two feature classes in the "memory" workspace?

 

src_layer = r"memory\survey_extent"
tar_layer = r"memory\new_survey_extent"
arcpy.management.Append(src_layer, tar_layer , "NO_TEST")

 

 

 

0 Kudos
1 Solution

Accepted Solutions
BlakeTerhune
MVP Regular Contributor

If you use the "NO_TEST" option for schema_type, you also need to use the field_mapping parameter to specify which fields can get mapped together. I've never tried NO_TEST without field_mappings but maybe this is the result. Append in memory workspace should work.

View solution in original post

0 Kudos
2 Replies
MattHowe
New Contributor III

So I managed to 'append' the features using an insert/update cursor sequence. That said, it would be great to understand why append doesn't seem to be working between two features in 'memory'.

 

ins_cur = arcpy.da.InsertCursor(r"memory\new_survey_extent", "SHAPE@")
with arcpy.da.SearchCursor(r"memory\survey_extent", "SHAPE@") as cursor:
    for row in cursor:
        ins_cur.insertRow(row)
del ins_cur

 

0 Kudos
BlakeTerhune
MVP Regular Contributor

If you use the "NO_TEST" option for schema_type, you also need to use the field_mapping parameter to specify which fields can get mapped together. I've never tried NO_TEST without field_mappings but maybe this is the result. Append in memory workspace should work.

0 Kudos