[pgpointcloud] Combine PC_Patch and PC_MakePoint

Éric Lemoine eric.lemoine at oslandia.com
Tue May 15 01:57:59 PDT 2018


On Tue, 2018-05-15 at 07:34 +0000, Lars wrote:
> The pointcloud webpage shows how to insert data into a points table
> and how to insert data from a points table into a patch table.
> 
> How can I create a patch and insert it into a patch table without
> using a points table?
> 
> The below query produces the error message "function pc_patch(record)
> does not exist".
> 
> insert into dummy(pa) select PC_Patch(bar) from (select
> PC_MakePoint(1, ARRAY[x,y,z] from (select val as x, val as y, val as
> z from generate_series(1,10,1) as val) as foo) as bar;


Not sure what you want to do exactly but here's a query that works:

select pc_patch(pt) from (select pc_makepoint(1, array[v, v, v, 1]) pt
from generate_series(1, 10) v) t;

Which can also be written as:

select pc_patch(pt) from generate_series(1, 10) v, pc_makepoint(1,
array[v, v, v, 1]) pt;

Now adding the insertion part:

insert into dummy(pa) select pc_patch(pt) pa from generate_series(1,
10) v, pc_makepoint(1, array[v, v, v, 1]) pt;

Note that this will create (and insert) just one patch.

Here's a new query that creates patches of 5 points:

select pc_patch(pt) from (select pt, (row_number() over ()) - 1 num
from generate_series(1, 10) v, pc_makepoint(1, array[v, v, v, 1]) pt) t
group by num / 5;


Hope this helps.

-- 
Éric Lemoine
Oslandia
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <http://lists.osgeo.org/pipermail/pgpointcloud/attachments/20180515/0ea6ccd9/attachment.sig>


More information about the pgpointcloud mailing list