Select to view content in your preferred language

Merge Features to Existing Feature

1005
5
Jump to solution
10-23-2024 04:56 AM
RomanaZemankova
Emerging Contributor

Hi,

I need to create an add-in that merges two features into one existing one. But the Merge method only offers a merge to a new feature. (Merge Method—ArcGIS Pro).

Which method should I use?

I need basically the same functionality that the Tool -> Merge -> Existing Feature offers in ArcGIS Pro, but with certain conditions (e.g. a smaller area is always merged to a larger one, a shorter line to a longer one, etc.). So I create my own add-in.

Can you please advise me?

Thank you,

Romana Zemankova

0 Kudos
1 Solution

Accepted Solutions
GKmieliauskas
Esri Regular Contributor

Hi,

I would like suggest you workaround I used in my case. I needed to update polygon feature with new geometry, but using EditOperation ConstructPolygons I got few polygons. So after Execute of operation I checked all results, selected one with my criteria, copied shape from new feature and made undo of last operation. After that I created new EditOperation and called Modify and Execute methods

View solution in original post

0 Kudos
5 Replies
GKmieliauskas
Esri Regular Contributor

Hi,

I would like suggest you workaround I used in my case. I needed to update polygon feature with new geometry, but using EditOperation ConstructPolygons I got few polygons. So after Execute of operation I checked all results, selected one with my criteria, copied shape from new feature and made undo of last operation. After that I created new EditOperation and called Modify and Execute methods

0 Kudos
RomanaZemankova
Emerging Contributor

Hello, thank you very much for your suggestion.

For me, it is essential that the objectID of the element to which the second element is merged is preserved.

So your suggestion is that I merge into a new feature, take the geometry from the new feature, then cancel this operation and modify the original feature with the geometry of merge and delete the second feature?

 

 

0 Kudos
GKmieliauskas
Esri Regular Contributor

Seems like correct workflow.

P.s. Don't forget to set SelectNewFeatures flag of EditOperation to true. Only your new feature will be selected after merge execution and you can take new objectid from selection for shape copying

0 Kudos
RomanaZemankova
Emerging Contributor

Thank you, I'll try this solution.

0 Kudos
RomanaZemankova
Emerging Contributor

Hello,

my final solution is that I made the GeometryEngine.Instance.Union(polygon1, polygon2) operation, and then I changed the geometry of one feature and deleted the second feature. I avoided undo operation.

0 Kudos