Hi, AG community,
I have to edit a feature class of polygons so that it matches another feature class of polygons.
I have a feature class with up-to-date topographic data and I have to update a feature class that represents only the waterway based on it. In other words, I have to align the water surfaces with the ones from the topographic feature.
Sometimes, I only need to make small adjustments, then it's easier just to edit the vertices so that the borders match the ones from the topographic surface.
But in some cases, the difference is pretty big and I think it would be simpler to just make a copy of the surface in the topographic database and include it in the waterway database.
I arrive at the real problem. The databases don't contain the same fields. Plus, it's really important that I keep the object ID in the waterway feature class which is automatically created. I can't make new ones.
Does anyone have an idea how I can add a new version of a feature in a database without losing the data that is already linked with the old version (not aligned) of the feature? Or if you have other solutions to propose, I am interested to hear about them.
Thanks in advance!
Solved! Go to Solution.
There's also this really great feature under Editor Settings → Field Mapping. These settings apply to the Transfer Attributes tool.
You can set your fields to align as needed, if the fields are different. Importantly, you can include the shape as a transferred attribute. It's also possible to use expressions for the transfer, if, for example, you needed to convert from meters in one layer to feet in the other, or wanted to concatenate two fields from one to a single field in the other.
You have to be quite careful which features you click on with the Transfer Attributes tool, but you can always hit "Undo" if you've modified the wrong one.
Option 1:
Option 2:
source_layer = "Layer with the correct shape"
destination_layer = "Layer with the wrong shape"
correct_shape = [row[0] for row in arcpy.da.SearchCursor(source_layer, ["SHAPE@"])][0]
with arcpy.da.UpdateCursor(destination_layer, ["SHAPE@"]) as cursor:
for row in cursor:
cursor.updateRow([correct_shape])
Thanks Johannes, I will have a look!
There's also this really great feature under Editor Settings → Field Mapping. These settings apply to the Transfer Attributes tool.
You can set your fields to align as needed, if the fields are different. Importantly, you can include the shape as a transferred attribute. It's also possible to use expressions for the transfer, if, for example, you needed to convert from meters in one layer to feet in the other, or wanted to concatenate two fields from one to a single field in the other.
You have to be quite careful which features you click on with the Transfer Attributes tool, but you can always hit "Undo" if you've modified the wrong one.
Thanks @jcarlson I will have a look!