<div dir="ltr">Hi, Lars,<div><br></div><div>It appears that the key issue is number of features in each grid.  That is why you used contect-based_grid.</div><div><br></div><div>If that is the key issue, logic can be built to count the number of rows obtained for each grid.  If the count is greater than a threshold, further break down can be achieved with the same function.</div><div><br></div><div>This is to anticipate the growth of data over time.</div><div><br></div><div>Is that correct?</div><div><br></div><div>Regards,</div><div><br></div><div>David</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 28 Mar 2022 at 07:49, Lars Aksel Opsahl <<a href="mailto:Lars.Opsahl@nibio.no">Lars.Opsahl@nibio.no</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 dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div id="gmail-m_8832745671236057921appendonsend"></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<hr style="display:inline-block;width:98%">
>From: postgis-users <<a href="mailto:postgis-users-bounces@lists.osgeo.org" target="_blank">postgis-users-bounces@lists.osgeo.org</a>> on behalf of Mike Taves <<a href="mailto:mwtoews@gmail.com" target="_blank">mwtoews@gmail.com</a>>Sent: Sunday, March 27, 2022 10:31 PMTo: PostGIS Users Discussion <<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a>>Subject: Re: [postgis-users] Cut extent box2d into small
 regular boxes, and iterate through each box of features
<div>> </div>
<div>>On Sat, 26 Mar 2022 at 02:44, Shaozhong SHI <<a href="mailto:shishaozhong@gmail.com" target="_blank">shishaozhong@gmail.com</a>> wrote:</div>
<div>>> Is there a procedure to get a box2d for the extent of features?</div>
<div>>> Divide the box into smaller regular boxes</div>
<div>>> loop carry out geospatial operation in each box</div>
<div>></div>
<div>>A few ideas to generate the small regular boxes, see:</div>
<div>>- <a href="https://postgis.net/docs/ST_SquareGrid.html" target="_blank">https://postgis.net/docs/ST_SquareGrid.html</a></div>
<div>>- <a href="https://gis.stackexchange.com/q/16374/" target="_blank">https://gis.stackexchange.com/q/16374/</a></div>
<div>></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Hi</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
We use a lot of grids, but we have seen that using content to influence each grid cell size is more important than having regular sized grid cell. For instance, smaller cell's where it's high density of polygons and larger cell in other areas. When grid cells
 are "equal" related to content (and not spatial size) it also easier to run thing parallel without running into memory problems and so on.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Here is some sample code <a href="https://github.com/larsop/content_balanced_grid" id="gmail-m_8832745671236057921LPNoLPOWALinkPreview" target="_blank">
https://github.com/larsop/content_balanced_grid</a><br>
</div>
<div></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
to create grids and here some code where we use such a grid <a href="https://github.com/larsop/find-overlap-and-gap" id="gmail-m_8832745671236057921LPNoLPOWALinkPreview_1" target="_blank">
https://github.com/larsop/find-overlap-and-gap</a> .<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Lars<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
</div>

_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/postgis-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-users</a><br>
</blockquote></div>