<div dir="ltr"><div dir="ltr"><div dir="ltr">Hello all,<div><br></div><div>A follow on question to the below... is it possible to add an additional column to data stored as a pgPointcloud ?</div><div>Reason I ask is that I am using the RANSAC algorithm to detect roof shapes (i.e. which Cartesian equation of a plane fits the most points). </div><div>Currently the algorithm will only find the plane equation which fits the biggest number of points in a point cloud. However there is usually more than one roof in a point cloud, so I would like to add a column to indicate that a point already belongs to a plane so the algorithm can exclude, re-reun and find the next biggest biggest plane, etc. etc., until a minimum threshold in area is reached.  </div><div>I am thinking the new column should be either a binary flag, or a foreign key to a separate table of plane equations. </div><div>If the above is not possible, then I would assume that I need to dump out the pgPointcloud into a standard PostGIS point geometry table, where I can add additional column? </div><div><br></div><div>Thanks,<br>Neil</div><div> </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 28 Mar 2023 at 21:08, Regina Obe <<a href="mailto:lr@pcorp.us">lr@pcorp.us</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 class="msg-8072085519394452931"><div lang="EN-US"><div class="m_-8072085519394452931WordSection1"><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">You can use the PC_Explode function to access individual points.  It converts a patch into individual PcPoints.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><a href="https://pgpointcloud.github.io/pointcloud/functions/patchs.html#pc-explode" target="_blank">https://pgpointcloud.github.io/pointcloud/functions/patchs.html#pc-explode</a><u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">You can use the PC_PointN to access individual points by index number in the patch.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><a href="https://pgpointcloud.github.io/pointcloud/functions/patchs.html#pc-pointn" target="_blank">https://pgpointcloud.github.io/pointcloud/functions/patchs.html#pc-pointn</a><u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">So for example to pick at random 3 points, you can do something like (NOT TESTED)<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">SELECT PC_PointN(pa, index) AS pcp<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">FROM patches AS p,  PC_NumPoints(<a href="http://p.pa" target="_blank">p.pa</a>) AS np<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">CROSS JOIN LATERAL (SELECT index FROM generate_series(1, np) AS index ORDER BY random() LIMIT 3) AS pi(index);<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Hope that helps,<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Regina<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><div style="border-top:none;border-right:none;border-bottom:none;border-left:1.5pt solid blue;padding:0in 0in 0in 4pt"><div><div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0in 0in"><p class="MsoNormal"><b><span style="font-size:11pt;font-family:Calibri,sans-serif">From:</span></b><span style="font-size:11pt;font-family:Calibri,sans-serif"> pgpointcloud [mailto:<a href="mailto:pgpointcloud-bounces@lists.osgeo.org" target="_blank">pgpointcloud-bounces@lists.osgeo.org</a>] <b>On Behalf Of </b>Neil Underhill<br><b>Sent:</b> Tuesday, March 28, 2023 12:47 PM<br><b>To:</b> <a href="mailto:pgpointcloud@lists.osgeo.org" target="_blank">pgpointcloud@lists.osgeo.org</a><br><b>Subject:</b> [pgpointcloud] How to create a PcPoint table in PostGIS?<u></u><u></u></span></p></div></div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">I have a .laz file with about 51m points in it  (225 MB in size), and want to run a RANSAC algorithm to detect roof planes. <u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">I would like to add the LIDAR data to a PostGIS database so I can interact with other geospatial layers (e.g. use a mask to filter the points to consider) and also access individual points to input into the algorithm. <u></u><u></u></p></div><div><p class="MsoNormal">I have been following the information here (<a href="https://pgpointcloud.github.io/pointcloud/concepts/objects.html" target="_blank">https://pgpointcloud.github.io/pointcloud/concepts/objects.html</a>) about the different Point Cloud Objects. <u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">My question is, if I store the data as a PcPatch, will I be able to access the individual points (e.g. select three points at random, that may or may not be in the same patch) ? <u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">If not, it seems I will need to store as PcPoint. If it's the latter, I am not clear how I create a database with PcPoint objects, as the example in the Quickstart (<a href="https://pgpointcloud.github.io/pointcloud/quickstart.html" target="_blank">https://pgpointcloud.github.io/pointcloud/quickstart.html</a>) only creastes a PcPatch table.  <u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Thanks for any advice,<u></u><u></u></p></div><div><p class="MsoNormal">Neil<u></u><u></u></p></div></div></div></div></div></div></blockquote></div></div></div>