What algorithm to use to correct (average) the borderline between 2 polygons? All I know is that they have their own borderlines very close to each other. Sometimes they may overlap, otherwise not.
As in the image it's visible the common line is fatter than outside borders so it's not ok.
I'd require some average line or just common border - make them adjacent. Those differences are very small so averaging is ok.
SpatialPolygons I tried the following:
sf_p1 = sf::st_as_sf(p1) sf_p2 = sf::st_as_sf(p2) sf_u = sf::st_union(sf_p1, sf_p2) d = gDistance(p1, p2)
The plot remains the same.
d takes 3.03 so I guess there's a little gap between them. I'd probably use buffers? But how?