3

I have a set of polygons and they can overlap with each other, like this: enter image description here

I want to modify them in such a way that they don't overlap and the resulting surface area stays the same. Something like this:

enter image description here

It is okay if the shape or the position changes. The main thing is that they should not overlap with each other and the area should not change much (I know the area changed a little in the second image but I drew it manually thus let's just assume that the areas did not change).

I am trying to do it programmatically with the help of Python. Basically I stored polygons in a PostGIS database and with the help of a script I want to retrieve them and modify them.

I am very new to GIS and thus this seems like a difficult task.

What is the correct way of doing it? Is there an algorithm that solves this kind of problems?

Jim Jones
  • 18,404
  • 3
  • 35
  • 44
Jahongir Rahmonov
  • 13,083
  • 10
  • 47
  • 91

2 Answers2

0

Take a look at ST_buffer and try passing a signed float as the second argument (degrees to reduce radius by)

SELECT buffer(the_geom,-0.01) as geom

Be careful with negative buffers as you could run into issues if the buffer size exceeds the radius, see here.

dcd018
  • 711
  • 5
  • 13
0

Here is what I did:

Iterated over all the polygons and found overlapping polygons. Then, I moved the polygon in different directions and found the best moving direction by calculating the minimum resulting overlapping area. Then I simply moved the polygon in that best direction until there is no overlapping area.

Jahongir Rahmonov
  • 13,083
  • 10
  • 47
  • 91