<div dir="ltr">Thanks for the vote of approval!<div><br></div><div>And also for the thought-provoking ideas about a function signature for full overlay, and about grid-based parallelization.  Will keep those in mind for if and when there is time to work on this. </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Nov 26, 2020 at 2:05 PM Andrew Joseph <<a href="mailto:ap.joseph@live.com">ap.joseph@live.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">





<div lang="EN-US">
<div class="gmail-m_-2720242800720985287WordSection1">
<p class="MsoNormal">This would be incredibly useful and likely become one of the most used functions in Postgis!
</p>
<p class="MsoNormal"><br>
Personally I think the simplest most intuitive function definition would be</p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">st_polygonal_overlay(idpoly[]) RETURNS SETOF idpolyportion;<br>
<br>
CREATE TYPE idpoly(</p>
<p class="MsoNormal">  id integer,</p>
<p class="MsoNormal">   geom geometry(Polygon)</p>
<p class="MsoNormal">);</p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">CREATE TYPE idpoly_portion(</p>
<p class="MsoNormal">  parent_ids integer[],</p>
<p class="MsoNormal">  geom geometry(Polygon)</p>
<p class="MsoNormal">);</p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">This would make it trivial to recombine the geometries with the originals.<br>
<br>
The biggest question I’d have would be how would parallelization work? Might be helpful to have another function that would create an ideal grid for clipping input geometries maybe something like:</p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">st_create_parallel_overlay_grid(geoms geometry[], numcores integer, max_mem_per_grid integer) RETURNS box2d;<br>
<br>
This way you could spread out st_polygonal_overlay across cores, then recombine using st_union by comparing parent_ids.</p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Sent from <a href="https://go.microsoft.com/fwlink/?LinkId=550986" target="_blank">
Mail</a> for Windows 10</p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>

</blockquote></div>