I had a similar problem, and the same idea to use GeoPandas to solve it, so I did.
It was a mistake. It was more complex than I thought it would be, and it was not as fast as I had hoped it would be. You may find it useful if you are patient:
https://gist.github.com/lnorton/4715b624f20544d04b225012b28ab1bd
I used sjoin
with the touches
predicate to pair all the polygons to be deleted with adjacent polygons which they may have their geometry merged into. This is computationally expensive.
Then iterated the result to determine which of those pairings is the actual best for each particular polygon, and tagged them together in a column created for that purpose. This is complicated by the fact that polygons to be deleted can also be the best match for merging the geometry of other polygons to be deleted, so they all must be included in the same group.
Then called dissolve
to perform the actual merging, using that grouping column as the by
parameter, and using the aggfunc
callback to find and carry the row data of the surviving polygon that eats the others into the new row that replaces them.