mirror of
https://github.com/pgpointcloud/pointcloud.git
synced 2025-12-08 20:36:04 +00:00
136 lines
5.6 KiB
Plaintext
136 lines
5.6 KiB
Plaintext
CREATE EXTENSION pointcloud;
|
|
INSERT INTO pointcloud_formats (pcid, srid, schema)
|
|
VALUES (1, 0,
|
|
'<?xml version="1.0" encoding="UTF-8"?>
|
|
<pc:PointCloudSchema xmlns:pc="http://pointcloud.org/schemas/PC/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
|
<pc:dimension>
|
|
<pc:position>1</pc:position>
|
|
<pc:size>4</pc:size>
|
|
<pc:description>X coordinate as a long integer. You must use the scale and offset information of the header to determine the double value.</pc:description>
|
|
<pc:name>X</pc:name>
|
|
<pc:interpretation>int32_t</pc:interpretation>
|
|
<pc:scale>0.01</pc:scale>
|
|
</pc:dimension>
|
|
<pc:dimension>
|
|
<pc:position>2</pc:position>
|
|
<pc:size>4</pc:size>
|
|
<pc:description>Y coordinate as a long integer. You must use the scale and offset information of the header to determine the double value.</pc:description>
|
|
<pc:name>Y</pc:name>
|
|
<pc:interpretation>int32_t</pc:interpretation>
|
|
<pc:scale>0.01</pc:scale>
|
|
</pc:dimension>
|
|
<pc:dimension>
|
|
<pc:position>3</pc:position>
|
|
<pc:size>4</pc:size>
|
|
<pc:description>Z coordinate as a long integer. You must use the scale and offset information of the header to determine the double value.</pc:description>
|
|
<pc:name>Z</pc:name>
|
|
<pc:interpretation>int32_t</pc:interpretation>
|
|
<pc:scale>0.01</pc:scale>
|
|
</pc:dimension>
|
|
<pc:dimension>
|
|
<pc:position>4</pc:position>
|
|
<pc:size>2</pc:size>
|
|
<pc:description>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.</pc:description>
|
|
<pc:name>Intensity</pc:name>
|
|
<pc:interpretation>uint16_t</pc:interpretation>
|
|
<pc:scale>1</pc:scale>
|
|
</pc:dimension>
|
|
<pc:metadata>
|
|
<Metadata name="compression"></Metadata>
|
|
<Metadata name="ght_xmin"></Metadata>
|
|
<Metadata name="ght_ymin"></Metadata>
|
|
<Metadata name="ght_xmax"></Metadata>
|
|
<Metadata name="ght_ymax"></Metadata>
|
|
<Metadata name="ght_keylength"></Metadata>
|
|
<Metadata name="ght_depth"></Metadata>
|
|
<Metadata name="spatialreference" type="id">4326</Metadata>
|
|
</pc:metadata>
|
|
</pc:PointCloudSchema>'
|
|
);
|
|
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_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)
|
|
|
|
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');
|
|
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]]}
|
|
(2 rows)
|
|
|
|
SELECT PC_Envelope(pa) from pa_test;
|
|
pc_envelope
|
|
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
\x010300000001000000050000007b14ae47e17a943fb81e85eb51b89e3f7b14ae47e17a943fb81e85eb51b89e3f7b14ae47e17a943fb81e85eb51b89e3f7b14ae47e17a943fb81e85eb51b89e3f7b14ae47e17a943fb81e85eb51b89e3f
|
|
\x01030000000100000005000000b81e85eb51b8ae3fec51b81e85ebb13fb81e85eb51b8ae3f9a9999999999b93f0ad7a3703d0ab73f9a9999999999b93f0ad7a3703d0ab73fec51b81e85ebb13fb81e85eb51b8ae3fec51b81e85ebb13f
|
|
(2 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)
|
|
|
|
--DROP TABLE pts_collection;
|
|
--DROP TABLE pt_test;
|
|
--DROP TABLE pa_test;
|