This chapter contains descriptions of the point cloud subprograms shown in Table 27-1.
Table 27-1 Point Cloud Subprograms
Subprogram | Description |
---|---|
Performs a clip operation on a point cloud. |
|
Performs a clip operation on a flat-format point cloud, in which the point cloud data is stored in a flat table. |
|
Generates contour lines for a point cloud. |
|
Creates a point cloud using the points specified in the |
|
Drops the dependencies between a point cloud block table and a specified base table and column. |
|
Initializes a point cloud. |
|
Returns a geometry object representing all or part of a point cloud. |
To use the subprograms in this package, you must understand the main concepts related to three-dimensional geometries, including the use of point clouds to model solids. Section 1.11 describes support for three-dimensional geometries, Section 1.11.2 describes the use of point clouds to model solids, and Section 2.6 describes data types related to point clouds.
SDO_PC_PKG.CLIP_PC(
inp IN SDO_PC,
ind_dim_qry IN SDO_GEOMETRY,
other_dim_qry IN SDO_MBR,
qry_min_res IN NUMBER,
qry_max_res IN NUMBER,
blkno IN NUMBER DEFAULT NULL.
include_custom_dims IN NUMBER DEFAULT 0
) RETURN SDO_PC_BLK_TYPE;
Point cloud on which to perform the clip operation.
For querying the indexed dimensions of the point cloud: window from which to select objects to be returned; typically a polygon for two-dimensional geometries or a frustum for three-dimensional geometries.
For querying the nonindexed dimensions of the point cloud: window from which to select objects to be returned; typically a polygon for two-dimensional geometries or a frustum for three-dimensional geometries. The nonindexed dimensions are those that are included in the total dimensionality but are not indexed. For an explanation of index dimensionality and total dimensionality, see the explanation of the pc_tot_dimensions
parameter of the SDO_PC_PKG.INIT function.
The SDO_MBR type is defined as (LOWER_LEFT SDO_VPOINT_TYPE, UPPER_RIGHT SDO_VPOINT_TYPE)
and SDO_V_POINT_TYPE is defined as VARRAY(64) OF NUMBER
.
Minimum resolution value. Objects in qry
with resolutions equal to or greater than qry_min_res
and less than or equal to qry_max_res
are returned by the clip operation.
Maximum resolution value. Objects in qry
with resolutions equal to or greater than qry_min_res
and less than or equal to qry_max_res
are returned by the clip operation.
Block ID number of the block to which to restrict the objects returned by the clip operation. If this parameter is null, all objects that satisfy the other parameters are returned.
Numeric value 0 or 1, which determines whether the point cloud blocks returned by the function contain only the regular (type NUMBER) dimensions, as included in the PC_TOT_DIMENSIONS count of SDO_PC. If only these regular dimensions should be returned, then include_custom_dims=0
(the default). The stored point cloud blocks in the block table still contain any additional custom dimensions, but this individual CLIP_PC query then does not return them.
include_custom_dims=1
includes both regular and custom dimensions.
See the Usage Notes for more information about custom dimensions.
This function returns points from a point cloud that are within a specified query window and that satisfy any other requirements specified by the parameters. A common use of this function is to perform queries on point clouds. You can maximize the performance of a point cloud query by minimizing the number of objects that the function needs to consider for the operation.
The SDO_PC and SDO_PC_BLK_TYPE data types are described in Section 2.6.
This function supports the storage and querying of custom dimensions. Custom dimensions can be of type NUMBER or other types, and they are not included in the PC_TOT_DIMENSIONS count of SDO_PC. If include_custom_dims=1
, the custom dimensions can be part of a query result, but they cannot be part of the query restriction, either in the ind_dimqry
or other_dimqry
parameters, because custom dimensions might not be of numeric type (and thus cannot be represented in the numeric interface of ind_dimqry
or other_dimqry
).
Custom dimensions cannot be created using the SDO_PC_PKG.CREATE_PC procedure.
Contrast this function with SDO_PC_PKG.CLIP_PC_FLAT, which takes as input point cloud data stored in a flat table (as opposed to an SDO_PC object).
Section 1.11.2 describes how to use point clouds to model solids.
The following example performs a clip operation on a point cloud. It is taken from the $ORACLE_HOME/md/demo/PointCloud/examples/plsql/pc.sql
example program, which is available if you installed the files from the Oracle Database Examples media (see Oracle Database Examples Installation Guide).
. . . declare inp sdo_pc; begin select pc INTO inp from base where rownum=1; insert into restst select * from table(sdo_pc_pkg.clip_pc ( inp, -- Input point cloud object sdo_geometry(2003, 8307, null, sdo_elem_info_array(1, 1003, 3), sdo_ordinate_array(-175.86157, -14.60521, 0,0)), -- Query null, null, null)); end; / . . .
SDO_PC_PKG.CLIP_PC_FLAT(
geometry IN SDO_GEOMETRY,
table_name IN VARCHAR2,
tolerance IN NUMBER,
other_dim_qry IN SDO_MBR,
mask IN VARCHAR2 DEFAULT NULL
) RETURN REF CURSOR;
Performs a clip operation on a flat-format point cloud, in which the point cloud data is stored in a flat table.
Two-dimensional geometry to serve as the clip window. For example:
geometry => SDO_GEOMETRY( 2003, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 3), SDO_ORDINATE_ARRAY( 0.75, 0.75, 1.25, 1.25))
Name of the table or view containing the point cloud data. The first two columns in the table or view must be named X and Y and be of type Oracle NUMBER. Optionally, following X and Y, the table or view can contain a Z column of type NUMBER, and additional nonspatial point cloud attributes. The additional nonspatial point cloud attributes can be any data type, but must be type Oracle NUMBER if they will participate as constraints in the other_dim_qry
parameter.
Tolerance value for objects in the point cloud (see Section 1.5.5 for information about spatial tolerance). If this parameter is null, the default value is 0.0000000000005
Minimum bounding rectangle (MBR) to provide a user defined query ranges for any Oracle NUMBER type columns (not including the X and Y columns).
The SDO_MBR type is defined as (LOWER_LEFT SDO_VPOINT_TYPE, UPPER_RIGHT SDO_VPOINT_TYPE)
and SDO_V_POINT_TYPE is defined as VARRAY(64) OF NUMBER
.
Specify NULL in the SDO_V_POINT_TYPE array for Oracle NUMBER type columns that are not constrained by a query range.
The topological relationship of interest, as applicable to points interacting with polygons. Valid values are 'mask=
<value>
'
where <value>
is one or more of the mask values valid for the SDO_RELATE operator (TOUCH
, OVERLAPBDYDISJOINT
, OVERLAPBDYINTERSECT
, EQUAL
, INSIDE
, COVEREDBY
, CONTAINS
, COVERS
, ANYINTERACT
, ON
), or FILTER
, which performs an approximate check. FILTER
will return all the candidates that intersect the polygon, and possibly a few more. Multiple masks are combined with the logical Boolean operator OR
(for example, 'mask=inside+touch'
); however, FILTER
cannot be combined with any other mask.
If this parameter is null or contains an empty string, mask=ANYINTERACT
is assumed.
This function works with flat-format point clouds, in contrast to SDO_PC_PKG.CLIP_PC, which works with input point cloud data stored in an SDO_PC object. The flat format has been added to point cloud support to offer an alternative to SDO_PC, depending on hardware environment and usage patterns. One advantage of the flat format is its dynamic nature, since updates to the point data do not require reblocking.
In environments other than Exadata, it is highly recommended that you create a compound B-tree index on the X, Y columns. In the compound B-tree index, also include any other Oracle NUMBER columns that will constrained with user-defined query ranges described for the other_dim_qry
parameter. Any point cloud data update will result in an automatic update of that B-tree index.
Contrast this function with SDO_PC_PKG.CLIP_PC, which takes as input point cloud data stored in an SDO_PC object.
Section 1.11.2 describes how to use point clouds to model solids. It includes some discussion of the SDO_PC and flat table approaches for storing point cloud data.
The following example creates a view named INPTAB2 from the first three columns of a table named INPPTAB. It then performs a clip operation on the point cloud date.
CREATE VIEW inptab2 AS (select x x, y y, z z from inptab); DECLARE my_cursor sys_refcursor; TYPE rec IS RECORD(x NUMBER, y NUMBER, z number); TYPE lst IS TABLE OF rec; result_list lst; BEGIN my_cursor := SDO_PC_PKG.CLIP_PC_FLAT( geometry => MDSYS.SDO_GEOMETRY( 2003, NULL, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1, 1003, 3), MDSYS.SDO_ORDINATE_ARRAY( 0.75, 0.75, 1.25, 1.25)), table_name => 'INPTAB2', tolerance => 0.05, other_dim_qry => null, mask => null); FETCH my_cursor BULK COLLECT INTO result_list; FOR I in 1 .. result_list.COUNT LOOP dbms_output.put_line( '(' || result_list(i).x || ', ' || result_list(i).y || ', ' || result_list(i).z || ')'); END LOOP; CLOSE my_cursor; END; /
SDO_PC_PKG.CREATE_CONTOUR_GEOMETRIES(
pc IN SDO_PC,
sampling_resolution IN NUMBER,
elevations IN SDO_ORDINATE_ARRAY,
region IN SDO_GEOMETRY
) RETURN SDO_GEOMETRY_ARRAY;
Point cloud for which to generate contour lines.
A numeric value that determines the grid cell height and width in the coordinate reference system of the point cloud. The process of the contour generation is grid-based. The points within a grid cell get averaged. This means:
Two slightly different point clouds may result in the same contours, as long as the grid cells yield the same averages.
The number of vertices and smoothness of the contour lines is a direct function of the resolution.
An array of elevations for which contours should be generated.
A window (within the extent of the point cloud) further restricting the region within which the contour lines should be generated.
This function returns an array of SDO_GEOMETRY contours. The sequence of contours within the array is the same as the sequence in the elevations
input parameter. Each contour is a multiline string.
Contours enclosing higher elevations are oriented counterclockwise (like outer rings). Contours enclosing lower elevations are oriented clockwise (like inner rings).
Section 1.11.2 describes how to use point clouds to model solids.
The following example creates contour lines from a point cloud.
SELECT sdo_pc_pkg.create_contour_geometries( (SELECT pc FROM pcs WHERE pc_id = 1), sampling_resolution => 50, elevations => sdo_ordinate_array(100, 101), region => mdsys.sdo_geometry(2003, null, null, mdsys.sdo_elem_info_array(1, 1003, 3), mdsys.sdo_ordinate_array(-1000, 0, 999, 100))) FROM DUAL; SDO_PC_PKG.CREATE_CONTOUR_GEOMETRIES((SELECTPCFROMPCSWHEREPC_ID=1),SAMPLING_RESO -------------------------------------------------------------------------------- SDO_GEOMETRY_ARRAY(SDO_GEOMETRY(2002, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1, 5 , 2, 1), SDO_ORDINATE_ARRAY(-75.5, 24.5, -25.5, 74.5, 25.5, 74.5, 74.5, 25.5, 75 .5, 24.5)), SDO_GEOMETRY(2002, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1, 7, 2, 1) , SDO_ORDINATE_ARRAY(-76.5, 24.5, -75.5, 25.5, -26.5, 74.5, 26.5, 74.5, 74.5, 26 .5, 76.5, 24.5))) 1 row selected.
SDO_PC_PKG.CREATE_PC(
inp IN SDO_PC,
inptable IN VARCHAR2,
clstPcdataTbl IN VARCHAR2 DEFAULT NULL);
SDO_PC object to be used. This object must have been created by the SDO_PC_PKG.INIT function.
Name of the table or view containing the input point cloud data. This table or view should have the following columns:
RID (VARCHAR2(24)): Unique ID for each point
VAL_D1 (NUMBER): Ordinate in dimension 1
VAL_D2 (NUMBER): Ordinate in dimension 2
. . .
VAL_Dn (NUMBER): Ordinate in dimension n, where n is the highest-numbered dimension. n should match the pc_tot_dimensions
parameter value in the call to the SDO_PC_PKG.INIT function when the point cloud was initialized.
Name of the table for storing the resulting point data. If you do not specify a value, this table is not created. For more information about the table, see the Usage Notes.
The first few dimensions of the point cloud are indexed and can later be searched using the SDO_PC_PKG.CLIP_PC function. The exact number of dimensions to index is determined by the dimensionality of the point cloud extent in the initialized point cloud object, specifically: inp.pc_extent.sdo_gtype/1000
If you specify a view name in the inptable
parameter, the query SELECT ROWID FROM <view-name>
must not return any errors.
If you specify a table name in the clstPcdataTbl
parameter, the table must exist and have the following columns:
PTN_ID (NUMBER)
POINT_ID (NUMBER)
RID (VARCHAR2(24): Unique ID for each point
VAL_D1 (NUMBER): Ordinate in dimension 1
VAL_D2 (NUMBER): Ordinate in dimension 2
. . .
VAL_Dn (NUMBER): Ordinate in dimension n, where n is the highest-numbered dimension. n should match the pc_tot_dimensions
parameter value in the call to the SDO_PC_PKG.INIT function when the point cloud was initialized.
If a value is specified for the clstPcdataTbl
parameter, this function populates the table by assigning appropriate values for PTN_ID and POINT_ID and by copying the values from the inptable
table or view for other attributes. This table can be created as an index organized table. It can be used in applications for searching using SQL queries on dimensions other than those reflected in the index dimensionality. (For an explanation of index dimensionality and total dimensionality, see the explanation of the pc_tot_dimensions
parameter of the SDO_PC_PKG.INIT function.)
The SDO_PC and SDO_PC_BLK_TYPE data types are described in Section 2.6.
Section 1.11.2 describes how to use point clouds to model solids.
The following example creates a point cloud. It is taken from the $ORACLE_HOME/md/demo/PointCloud/examples/plsql/pc.sql
example program, which is available if you installed the files from the Oracle Database Examples media (see Oracle Database Examples Installation Guide).
. . . -- Create the blocks for the point cloud. sdo_pc_pkg.create_pc( pc, -- Initialized PointCloud object 'INPTAB', -- Name of input table to ingest into the pointcloud 'RES' -- Name of output table that stores the points (with ptn_id,pt_id) ); . . .
Drops the dependencies between a point cloud block table and a specified base table and column.
Name of a base table that was specified (in the basetable
parameter of the SDO_PC_PKG.INIT function) when the point cloud was initialized.
Name of a column in base table that was specified in the basecol
parameter of the SDO_PC_PKG.INIT function.
This procedure truncates the point cloud block table and removes the association between the block table and the base table and column combination.
After you execute this procedure, you can drop the point cloud block table or associate the table with another base table and column combination. For more information, see the Usage Notes for the SDO_PC_PKG.INIT function.
SDO_PC_PKG.GET_PT_IDS(
pts IN BLOB,
num_pts IN NUMBER,
pc_tot_dim IN NUMBER,
blk_domain IN SDO_ORGSCL_TYPE DEFAULT NULL,
) RETURN SDO_NUMBER_ARRAY;
Binary large object (BLOB) containing the point cloud block.
Number of points in the point cloud block. For a point cloud block, the number of points is stored in the NUM_POINTS column of the point cloud block table, which is described in Table 2-7 in Section 2.6.1.
Number of dimensions for the points in the point cloud block.
(Not currently used.)
This function returns an SDO_NUMBER_ARRAY object. The array contains multiple pairs of numbers, with each pair identifying the block ID and point ID of a point. For any specific call to this function, the block ID values associated with all points in the returned array will be the same. The SDO_NUMBER_ARRAY type is defined as VARRAY(1048576) OF NUMBER
.
Section 1.11.2 describes how to use point clouds to model solids.
The following example returns the block ID and point ID values of points in a point cloud block. It is taken from the $ORACLE_HOME/md/demo/PointCloud/examples/plsql/pc.sql
example program, which is available if you installed the files from the Oracle Database Examples media (see Oracle Database Examples Installation Guide).
SELECT SDO_PC_PKG.GET_PT_IDS( a.points, -- LOB containing the points a.num_points, -- # of points in the LOB 3 -- Total dimensionality of the points in the LOB ) FROM restst a WHERE num_points >0;
SDO_PC_PKG.INIT(
basetable IN VARCHAR2,
basecol IN VARCHAR2,
blktable IN VARCHAR2,
ptn_params IN VARCHAR2,
pc_extent IN SDO_GEOMETRY,
pc_tol IN NUMBER DEFAULT 0.0000000000005,
pc_tot_dimensions IN NUMBER DEFAULT 2,
pc_domain IN SDO_ORGSCL_TYPE DEFAULT NULL,
pc_val_attr_tables IN SDO_STRING_ARRAY DEFAULT NULL,
pc_other_attrs IN XMLTYPE DEFAULT NULL,
) RETURN SDO_PC;
Name of the base table containing a column of type SDO_PC.
Name of the column of type SDO_PC in the base table.
Name of the point cloud block table, which is used for storing the blocks of point cloud. This table must exist, and must have been created by a statement in the following form: CREATE TABLE <table-name> AS select * from mdsys.sdo_pc_blk_table;
Each point cloud block table can only be associated with only one basetable
and basecol
combination.
Parameters for partitioning the point cloud, specified as a quoted string with keywords delimited by commas. For example: 'blk_capacity=1000,work_tablespace=my_work_ts'
. If this parameter is null, the point cloud is not partitioned. The following keywords are permitted:
blk_capacity=n
, where n is the maximum number of rows in each partition. The default value is 5000. If specified, must be a number greater than or equal to 50.
work_tablespace=x
, where x is the name of the tablespace in which to create temporary tables during the partitioning operations.
SDO_GEOMETRY object representing the spatial extent of the point cloud (the minimum bounding object enclosing all objects in the point cloud). This parameter must not be null.
For geodetic data, this geometry must have two dimensions; otherwise, it can have up to four dimensions. The dimensionality of this geometry is used as the minimum value permitted for the pc_tot_dimensions
parameter, as explained in the description of that parameter.
Tolerance value for objects in the point cloud. (For information about spatial tolerance, see Section 1.5.5.) If this parameter is null, the default value is 0.0000000000005.
A number specifying the total dimensionality of the point cloud object. For each point in the point cloud blocks, pc_tot_dimensions
ordinates (values) are stored.
The total dimensionality must be greater than or equal to the index dimensionality, which is the number of dimensions in the pc_extent
geometry. Specifying total dimensionality greater than index dimensionality enables necessary nonspatial attributes to be retrieved in the same fetch operation with spatial data. The maximum total dimensionality value is 8. The default value for this parameter is 2.
(Not currently used.)
SDO_STRING_ARRAY object specifying the names of any value attribute tables for the point cloud. If this parameter is null, the point cloud has no associated value attribute tables. Type SDO_STRING_ARRAY is defined as VARRAY(1048576) OF VARCHAR2(32).
XMLTYPE object specifying any other attributes of the point cloud. If this parameter is null, the point cloud has no other attributes.
This parameter can include metadata on point cloud pyramiding, as explained in the Usage Notes.
After you use this function to initialize an SDO_PC object, you can create a point cloud by specifying this object as input to the SDO_PC_PKG.CREATE_PC procedure.
The SDO_PC data type is described in Section 2.5.
Section 1.11.2 describes how to use point clouds to model solids.
After you use this function, the blktable
table is kept in synchronization with the base table. For example, if a row is deleted from the basetable, the corresponding blocks of the point cloud object in that row are also deleted from the block table; and if the base table base table is truncated, the block table is truncated also.
The block table can be dropped only after either of the following occurs: the base table is dropped, or the SDO_PC_PKG.DROP_DEPENDENCIES procedure is executed.
The pc_other_attrs
parameter can be used to specify metadata for point cloud pyramiding, for example:
xmltype( '<opc:sdoPcObjectMetadata xmlns:opc="http://xmlns.oracle.com/spatial/vis3d/2011/sdovis3d.xsd" xmlns:las="http://liblas.org/schemas/LAS/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <opc:sdoPcPyramid preserveLevel1="true"/> </opc:sdoPcObjectMetadata>')
The XML Schema Definition (XSD) for the pc_other_attrs
parameter can be viewed by entering the following statements:
SET LONG 40000 SELECT xmlschema FROM sdo_xml_schemas WHERE description = 'EPSG sdo3d.xsd';
Point cloud pyramiding creates multiple pyramid levels from level 1 (leaves) to level n (root). Generally, points already stored at level i are not repeated, at any of the more detailed levels. Any point is physically stored, exactly once. The leaf level 1 can be exempted from this rule by specifying preserveLevel1="true"
(as in the preceding example), so that applications that are not pyramiding-compliant do not need to adapt. However, this preserveLevel1="true"
option (of exempting and thus preserving level 1) doubles the space requirement, because each point is then stored twice: once at root level 1, and once in the rest of the pyramid.
The following example initializes a point cloud by creating an SDO_PC object, and it displays the ID of the object. It is taken from the $ORACLE_HOME/md/demo/PointCloud/examples/plsql/pc.sql
example program, which is available if you installed the files from the Oracle Database Examples media (see Oracle Database Examples Installation Guide).
. . . declare pc sdo_pc; begin -- Initialize the point cloud object. pc := sdo_pc_pkg.init( 'BASE', -- Table that has the SDO_POINT_CLOUD column defined 'PC', -- Column name of the SDO_POINT_CLOUD object 'BLKTAB', -- Table to store blocks of the point cloud 'blk_capacity=1000', -- max # of points per block mdsys.sdo_geometry(2003, 8307, null, mdsys.sdo_elem_info_array(1,1003,3), mdsys.sdo_ordinate_array(-180, -90, 180, 90)), -- Extent 0.5, -- Tolerance for point cloud 3, -- Total number of dimensions null); . . .
SDO_PC_PKG.TO_GEOMETRY(
pts IN BLOB,
num_pts IN NUMBER,
pc_tot_dim IN NUMBER,
srid IN NUMBER DEFAULT NULL,
blk_domain IN SDO_ORGSCL_TYPE DEFAULT NULL
) RETURN SDO_GEOMETRY;
BLOB containing the points.
Maximum number of points to be included in the resulting geometry.
Number of spatial dimensions defined for the data.
Spatial reference (coordinate system) ID associated with the data. If this parameter is null, no SRID value is associated with the data.
(Not currently used.)
This function returns a single multipoint SDO_GEOMETRY object that represents all point geometries in the pts
parameter. For example, the points could reflect the result of a clip operation or the contents of an entire block.
Section 1.11.2 describes how to use point clouds to model solids.
The following example returns a multipoint collection geometry object representing a point cloud. It is taken from the $ORACLE_HOME/md/demo/PointCloud/examples/plsql/pc.sql
example program, which is available if you installed the files from the Oracle Database Examples media (see Oracle Database Examples Installation Guide).
. . . -- Return points in blk_id of the point cloud as a multipoint collection. select sdo_pc_pkg.to_geometry( a.points, -- point LOB a.num_points, -- # of points in the LOB 3, -- total dimensionality 8307 -- SRID ) from blktab a where blk_id=0; . . .