We have a problem that we are not quite sure how to approach, we have a number of polygons contained inside a larger bounding polygon, We need to expand these internal polygons as much as possible but only until a single edge touches the containing polygon.
I hope a diagram will help with my explanation:
The polygons in red can be assumed as already created, the dotted polygons in green indicate the final polygon that we want to create (enlarged just enough until one side touches the walls of the bounding polygon).
This will be run on big data (hundreds of millions of polygons with hundreds of millions of inner polygons) as such efficiency is one problem we are facing. In code this is reasonably trivial, however its not feasible for the dataset we have.
We have a large cluster setup that can process Geospatial SQL efficiently which we intend to use for this task but other than arbitrarily passing a value to an expand function we aren't quite sure how to do this intelligently over massive amounts of data.
I believe we need to scale the polygon using
ST_Expand and stop when
ST_Intersects on the main polygon is true - I just have no idea how to do that in a single SQL call.