[pgpointcloud] Combine PC_Patch and PC_MakePoint

Lars laasunde at hotmail.com
Thu May 24 00:10:31 PDT 2018


Eric,

Your suggestion was very helpful (as always).

Much Appreciated 😊


________________________________
Fra: Éric Lemoine <eric.lemoine at oslandia.com>
Sendt: 15. mai 2018 10:57
Til: Lars; pgpointcloud at lists.osgeo.org
Emne: Re: [pgpointcloud] Combine PC_Patch and PC_MakePoint

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 --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/pgpointcloud/attachments/20180524/c13b60b0/attachment.html>


More information about the pgpointcloud mailing list