[pgpointcloud] How to create a PcPoint table in PostGIS?

Neil Underhill neil.underhill at gmail.com
Wed Jun 28 01:34:55 PDT 2023


Hello all,

A follow on question to the below... is it possible to add an additional
column to data stored as a pgPointcloud ?
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).
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.
I am thinking the new column should be either a binary flag, or a foreign
key to a separate table of plane equations.
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?

Thanks,
Neil


On Tue, 28 Mar 2023 at 21:08, Regina Obe <lr at pcorp.us> wrote:

> You can use the PC_Explode function to access individual points.  It
> converts a patch into individual PcPoints.
>
>
>
> https://pgpointcloud.github.io/pointcloud/functions/patchs.html#pc-explode
>
>
>
>
>
> You can use the PC_PointN to access individual points by index number in
> the patch.
>
>
>
> https://pgpointcloud.github.io/pointcloud/functions/patchs.html#pc-pointn
>
>
>
>
>
> So for example to pick at random 3 points, you can do something like (NOT
> TESTED)
>
>
>
> SELECT PC_PointN(pa, index) AS pcp
>
> FROM patches AS p,  PC_NumPoints(p.pa) AS np
>
> CROSS JOIN LATERAL (SELECT index FROM generate_series(1, np) AS index
> ORDER BY random() LIMIT 3) AS pi(index);
>
>
>
> Hope that helps,
>
> Regina
>
>
>
>
>
> *From:* pgpointcloud [mailto:pgpointcloud-bounces at lists.osgeo.org] *On
> Behalf Of *Neil Underhill
> *Sent:* Tuesday, March 28, 2023 12:47 PM
> *To:* pgpointcloud at lists.osgeo.org
> *Subject:* [pgpointcloud] How to create a PcPoint table in PostGIS?
>
>
>
> 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.
>
>
>
> 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.
>
> I have been following the information here (
> https://pgpointcloud.github.io/pointcloud/concepts/objects.html) about
> the different Point Cloud Objects.
>
>
>
> 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) ?
>
>
>
> 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 (https://pgpointcloud.github.io/pointcloud/quickstart.html)
> only creastes a PcPatch table.
>
>
>
> Thanks for any advice,
>
> Neil
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/pgpointcloud/attachments/20230628/c042e65a/attachment.htm>


More information about the pgpointcloud mailing list