CREATE EXTENSION pointcloud; SELECT PC_Version(); pc_version ------------ 1.1.0 (1 row) INSERT INTO pointcloud_formats (pcid, srid, schema) VALUES (1, 0, ' 1 4 X coordinate as a long integer. You must use the scale and offset information of the header to determine the double value. X int32_t 0.01 2 4 Y coordinate as a long integer. You must use the scale and offset information of the header to determine the double value. Y int32_t 0.01 3 4 Z coordinate as a long integer. You must use the scale and offset information of the header to determine the double value. Z int32_t 0.01 4 2 The intensity value is the integer representation of the pulse return magnitude. This value is optional and system specific. However, it should always be included if available. Intensity uint16_t 1 none 4326 ' ); INSERT INTO pointcloud_formats (pcid, srid, schema) VALUES (3, 0, ' 1 4 X coordinate as a long integer. You must use the scale and offset information of the header to determine the double value. X int32_t 0.01 2 4 Y coordinate as a long integer. You must use the scale and offset information of the header to determine the double value. Y int32_t 0.01 3 4 Z coordinate as a long integer. You must use the scale and offset information of the header to determine the double value. Z int32_t 0.01 4 2 The intensity value is the integer representation of the pulse return magnitude. This value is optional and system specific. However, it should always be included if available. Intensity uint16_t 1 dimensional 4326 ' ); CREATE TABLE IF NOT EXISTS pt_test ( pt PCPOINT(1) ); \d pt_test Table "public.pt_test" Column | Type | Modifiers --------+------------+----------- pt | pcpoint(1) | DELETE FROM pt_test; INSERT INTO pt_test (pt) VALUES ('00000000020000000100000002000000030004'); ERROR: no entry in "pointcloud_formats" for pcid = 2 LINE 1: INSERT INTO pt_test (pt) VALUES ('00000000020000000100000002... ^ INSERT INTO pt_test (pt) VALUES ('00000000010000000100000002000000030004'); INSERT INTO pt_test (pt) VALUES ('00000000010000000200000003000000030005'); INSERT INTO pt_test (pt) VALUES ('00000000010000000300000004000000030006'); SELECT PC_Get(pt, 'Intensity') FROM pt_test; pc_get -------- 4 5 6 (3 rows) SELECT Sum(PC_Get(pt, 'y')) FROM pt_test; sum ------ 0.09 (1 row) SELECT PC_Get(pt) FROM pt_test; pc_get -------------------- {0.01,0.02,0.03,4} {0.02,0.03,0.03,5} {0.03,0.04,0.03,6} (3 rows) SELECT PC_AsText(pt) FROM pt_test; pc_astext ------------------------------------ {"pcid":1,"pt":[0.01,0.02,0.03,4]} {"pcid":1,"pt":[0.02,0.03,0.03,5]} {"pcid":1,"pt":[0.03,0.04,0.03,6]} (3 rows) SELECT PC_AsText(PC_Patch(pt)) FROM pt_test; pc_astext ----------------------------------------------------------------------------- {"pcid":1,"pts":[[0.01,0.02,0.03,4],[0.02,0.03,0.03,5],[0.03,0.04,0.03,6]]} (1 row) SELECT PC_AsText(PC_Explode(PC_Patch(pt))) FROM pt_test; pc_astext ------------------------------------ {"pcid":1,"pt":[0.01,0.02,0.03,4]} {"pcid":1,"pt":[0.02,0.03,0.03,5]} {"pcid":1,"pt":[0.03,0.04,0.03,6]} (3 rows) SELECT Sum(PC_MemSize(pt)) FROM pt_test; sum ----- 75 (1 row) CREATE TABLE IF NOT EXISTS pa_test ( pa PCPATCH(1) ); \d pa_test Table "public.pa_test" Column | Type | Modifiers --------+------------+----------- pa | pcpatch(1) | DELETE FROM pa_test; INSERT INTO pa_test (pa) VALUES ('0000000002000000000000000200000002000000030000000500060000000200000003000000050008'); ERROR: no entry in "pointcloud_formats" for pcid = 2 LINE 1: INSERT INTO pa_test (pa) VALUES ('00000000020000000000000002... ^ INSERT INTO pa_test (pa) VALUES ('0000000001000000000000000200000002000000030000000500060000000200000003000000050008'); INSERT INTO pa_test (pa) VALUES ('000000000100000000000000020000000600000007000000050006000000090000000A00000005000A'); INSERT INTO pa_test (pa) VALUES ('000000000100000000000000020000000600000007000000050006000000090000000A00000005000A'); INSERT INTO pa_test (pa) VALUES ('000000000100000000000000020000000600000007000000050006000000090000000A00000005000A'); SELECT PC_Uncompress(pa) FROM pa_test LIMIT 1; pc_uncompress ------------------------------------------------------------------------------------ 0101000000000000000200000002000000030000000500000006000200000003000000050000000800 (1 row) SELECT PC_AsText(pa) FROM pa_test; pc_astext ---------------------------------------------------------- {"pcid":1,"pts":[[0.02,0.03,0.05,6],[0.02,0.03,0.05,8]]} {"pcid":1,"pts":[[0.06,0.07,0.05,6],[0.09,0.1,0.05,10]]} {"pcid":1,"pts":[[0.06,0.07,0.05,6],[0.09,0.1,0.05,10]]} {"pcid":1,"pts":[[0.06,0.07,0.05,6],[0.09,0.1,0.05,10]]} (4 rows) SELECT PC_Envelope(pa) from pa_test; pc_envelope ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- \x010300000001000000050000007b14ae47e17a943fb81e85eb51b89e3f7b14ae47e17a943fb81e85eb51b89e3f7b14ae47e17a943fb81e85eb51b89e3f7b14ae47e17a943fb81e85eb51b89e3f7b14ae47e17a943fb81e85eb51b89e3f \x01030000000100000005000000b81e85eb51b8ae3fec51b81e85ebb13fb81e85eb51b8ae3f9a9999999999b93f0ad7a3703d0ab73f9a9999999999b93f0ad7a3703d0ab73fec51b81e85ebb13fb81e85eb51b8ae3fec51b81e85ebb13f \x01030000000100000005000000b81e85eb51b8ae3fec51b81e85ebb13fb81e85eb51b8ae3f9a9999999999b93f0ad7a3703d0ab73f9a9999999999b93f0ad7a3703d0ab73fec51b81e85ebb13fb81e85eb51b8ae3fec51b81e85ebb13f \x01030000000100000005000000b81e85eb51b8ae3fec51b81e85ebb13fb81e85eb51b8ae3f9a9999999999b93f0ad7a3703d0ab73f9a9999999999b93f0ad7a3703d0ab73fec51b81e85ebb13fb81e85eb51b8ae3fec51b81e85ebb13f (4 rows) SELECT PC_AsText(PC_Union(pa)) FROM pa_test; pc_astext ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- {"pcid":1,"pts":[[0.02,0.03,0.05,6],[0.02,0.03,0.05,8],[0.06,0.07,0.05,6],[0.09,0.1,0.05,10],[0.06,0.07,0.05,6],[0.09,0.1,0.05,10],[0.06,0.07,0.05,6],[0.09,0.1,0.05,10]]} (1 row) SELECT sum(PC_NumPoints(pa)) FROM pa_test; sum ----- 8 (1 row) CREATE TABLE IF NOT EXISTS pa_test_dim ( pa PCPATCH(3) ); \d pa_test_dim Table "public.pa_test_dim" Column | Type | Modifiers --------+------------+----------- pa | pcpatch(3) | INSERT INTO pa_test_dim (pa) VALUES ('0000000003000000000000000200000002000000030000000500060000000200000003000000050008'); INSERT INTO pa_test_dim (pa) VALUES ('000000000300000000000000020000000600000007000000050006000000090000000A00000005000A'); INSERT INTO pa_test_dim (pa) VALUES ('0000000003000000000000000200000002000000030000000500060000000200000003000000050003'); INSERT INTO pa_test_dim (pa) VALUES ('0000000003000000000000000200000002000000030000000500060000000200000003000000050001'); SELECT Sum(PC_NumPoints(pa)) FROM pa_test_dim; sum ----- 8 (1 row) SELECT Sum(PC_MemSize(pa)) FROM pa_test_dim; sum ----- 684 (1 row) SELECT Sum(PC_PatchMax(pa,'x')) FROM pa_test_dim; sum ------ 0.15 (1 row) SELECT Sum(PC_PatchMin(pa,'x')) FROM pa_test_dim; sum ------ 0.12 (1 row) DELETE FROM pa_test_dim; INSERT INTO pa_test_dim (pa) SELECT PC_Patch(PC_MakePoint(3, ARRAY[x,y,z,intensity])) FROM ( SELECT -127+a/100.0 AS x, 45+a/100.0 AS y, 1.0*a AS z, a/10 AS intensity, a/400 AS gid FROM generate_series(1,1600) AS a ) AS values GROUP BY gid; SELECT Sum(PC_NumPoints(pa)) FROM pa_test_dim; sum ------ 1600 (1 row) SELECT Sum(PC_MemSize(pa)) FROM pa_test_dim; sum ------ 8733 (1 row) SELECT Max(PC_PatchMax(pa,'x')) FROM pa_test_dim; max ------ -111 (1 row) SELECT Min(PC_PatchMin(pa,'x')) FROM pa_test_dim; min --------- -126.99 (1 row) SELECT Min(PC_PatchMin(pa,'z')) FROM pa_test_dim; min ----- 1 (1 row) --DROP TABLE pts_collection; DROP TABLE pt_test; DROP TABLE pa_test; DROP TABLE pa_test_dim;