[pgpointcloud] Height clouds

Stephen Mather stephen at smathermather.com
Thu Jul 10 19:28:35 PDT 2014


Hi All,

Playing a bit with calculating heights in pointcloud. I have a couple
questions.

First, is there a better way to get all the dimensions of a point cloud
exploded as columns or an array than a bunch of PC_Get on the exploded
patch? e.g. concatenated into text as follows:

WITH lraw AS (
    SELECT PC_Explode(pa) AS ex,  PC_PatchMin(pa, 'Z') AS min, id
    FROM test1 WHERE id < 10000
    )
SELECT PC_Get(ex, 'X') || ',' || PC_Get(ex, 'Y') || ',' || PC_Get(ex, 'Z')
- min || ',' ||
    PC_Get(ex, 'Intensity') || ',' || PC_Get(ex, 'ReturnNumber') || ',' ||
PC_Get(ex, 'NumberOfReturns') || ',' ||
    PC_Get(ex, 'ScanDirectionFlag') || ',' || PC_Get(ex,
'EdgeOfFlightLine') || ',' ||
    PC_Get(ex, 'Classification') || ',' || PC_Get(ex, 'ScanAngleRank') ||
',' || PC_Get(ex, 'UserData') || ',' ||
    PC_Get(ex, 'PointSourceId') || ',' || PC_Get(ex, 'Time') || ',' ||
PC_Get(ex, 'PointID') || ',' || PC_Get(ex, 'BlockID')
    AS xyheight, id FROM lraw;

My objective is to calculate heights as a difference between the current
point and the min for the patch (quick and dirty, but works) and then
converted back to a point cloud, but this feels very hackerish... :

WITH lraw AS (
    SELECT PC_Explode(pa) AS ex,  PC_PatchMin(pa, 'Z') AS min, id
    FROM test1 WHERE id < 10000
    ),
heights AS (
    SELECT PC_Get(ex, 'X') || ',' || PC_Get(ex, 'Y') || ',' || PC_Get(ex,
'Z') - min || ',' ||
    PC_Get(ex, 'Intensity') || ',' || PC_Get(ex, 'ReturnNumber') || ',' ||
PC_Get(ex, 'NumberOfReturns') || ',' ||
    PC_Get(ex, 'ScanDirectionFlag') || ',' || PC_Get(ex,
'EdgeOfFlightLine') || ',' ||
    PC_Get(ex, 'Classification') || ',' || PC_Get(ex, 'ScanAngleRank') ||
',' || PC_Get(ex, 'UserData') || ',' ||
    PC_Get(ex, 'PointSourceId') || ',' || PC_Get(ex, 'Time') || ',' ||
PC_Get(ex, 'PointID') || ',' || PC_Get(ex, 'BlockID')
    AS xyheight, id FROM lraw
    ),
heightcloud AS (
    SELECT PC_MakePoint(1, string_to_array(xyheight, ',')::float8[]) pt, id
FROM heights
    )
SELECT PC_Patch(pt) FROM heightcloud GROUP BY id / 20;

Thoughts?
Best,
Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/pgpointcloud/attachments/20140710/b78f8f3c/attachment.html>


More information about the pgpointcloud mailing list