This topic describes the details and usage of point cloud data. Point cloud data comprises points that are generated when a 3D scanner scans an object. Each point contains a set of 3D coordinates. Some points may contain RGB information or intensity. Point cloud data contains spatial coordinates and a large number of points that are presented in complex attribute dimensions.
Overview
GanosBase PointCloud is a plug-in of PostgreSQL. It provides features, such as point cloud data compression, point cloud data decompression, and attribute statistics collection, that allows PostgreSQL to store and manage point cloud data in an efficient and fast manner. GanosBase PointCloud can work with GanosBase Geometry to perform spatial analysis on point cloud data.
Point cloud data types
The types of point cloud data include pcpoint and pcpatch. For the pcpoint data type, each point is stored as a row. The dimensions of a point are defined in the point cloud schema. For the pcpatch data type, a number of points are stored as a set. Point cloud data of the pcpatch data type supports spatial queries and can be compressed to reduce storage usage. The compression parameter in the point cloud schema specifies the method that is used to compress point cloud data.
Point cloud schemas
The pointcloud_formats table stores point cloud schemas. Each schema contains the attribute dimensions of a point cloud object and the information about each dimension. The dimension information includes the size, type, name, and description.
Getting started
Enable GanosBase PointCloud.
Create extension ganos_pointcloud with schema public cascade; Create extension ganos_pointcloud_geometry with schema public cascade;
Insert a point cloud schema.
INSERT INTO pointcloud_formats (pcid, srid, schema) VALUES (1, 4326, '<?xml version="1.0" encoding="UTF-8"?> <pc:PointCloudSchema xmlns:pc="http://example.org/schemas/PC/1.1" xmlns:xsi="http://www.example.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">dimensional</Metadata> </pc:metadata> </pc:PointCloudSchema>');
Create a point cloud table.
-- Use the pcpoint data type. CREATE TABLE points ( id SERIAL PRIMARY KEY, pt PCPOINT(1) ); -- Use the pcpatch data type. CREATE TABLE patches ( id SERIAL PRIMARY KEY, pa PCPATCH(1) );
Insert data of pcpoint data type.
INSERT INTO points (pt) SELECT ST_MakePoint(1, 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 FROM generate_series(1,100) AS a ) AS values; SELECT ST_MakePoint(1, ARRAY[-127, 45, 124.0, 4.0]); ------------------------- 010100000064CEFFFF94110000703000000400 SELECT ST_AsText('010100000064CEFFFF94110000703000000400'::pcpoint); ------------------------- null
Insert data of pcpatch data type.
INSERT INTO patches (pa) SELECT ST_Patch(pt) FROM points GROUP BY id/10; SELECT ST_AsText(ST_MakePatch(1, ARRAY[-126.99,45.01,1,0, -126.98,45.02,2,0, -126.97,45.03,3,0])); ------------------------- {"pcid":1,"pts":[ [-126.99,45.01,1,0],[-126.98,45.02,2,0],[-126.97,45.03,3,0] ]}
Calculate the average values of all attribute dimensions in a pcpatch object.
SELECT ST_AsText(ST_PatchAvg(pa)) FROM patches WHERE id = 7; ------------------------- null
Disable GanosBase PointCloud.
Drop extension ganos_pointcloud_geometry; Drop extension ganos_pointcloud cascade;
References
For more information, see Point cloud SQL reference.