Oracle® Spatial Developer's Guide 11g Release 1 (11.1) Part Number B2840001 


View PDF 
This chapter contains descriptions of the triangulated irregular network (TIN) subprograms shown in Table 301.
Table 301 TIN Subprograms
Subprogram  Description 


Performs a clip operation on a TIN. 

Creates a TIN using the points specified in the 

Drops the dependencies between a TIN block table and a specified base table and column. 

Initializes a TIN. 

Returns a geometry object representing all or part of a TIN. 
To use the subprograms in this package, you must understand the main concepts related to threedimensional geometries, including the use of triangulated irregular networks (TINs) to model surfaces. Section 1.11 describes support for threedimensional geometries, Section 1.11.1 describes the use of TINs to model surfaces, and Section 2.5 describes data types related to TINs.
Format
SDO_TIN_PKG.CLIP_TIN(
inp IN SDO_TIN,
qry IN SDO_GEOMETRY,
qry_min_res IN NUMBER,
qry_max_res IN NUMBER,
blkid IN NUMBER DEFAULT NULL
) RETURN SDO_TIN_BLK_TYPE;
Description
Performs a clip operation on a TIN.
Parameters
TIN on which to perform the clip operation.
Window from which to select objects to be returned; typically a polygon for twodimensional geometries or a frustum for threedimensional geometries.
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.
Usage Notes
This function returns triangles from a TIN 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 TINs. You can maximize the performance of a TIN query by minimizing the number of objects that the function needs to consider for the operation.
The SDO_TIN and SDO_TIN_BLK_TYPE data types are described in Section 2.5.
Section 1.11.1 describes how to use TINs to model surfaces.
Examples
The following example performs a clip operation on a TIN. It is taken from the sdo_tin.sql
example program, which is under $ORACLE_HOME
/md/demo/examples/TIN/plsql/
if you installed the files from the Oracle Database Examples media.
. . . declare inp sdo_tin; begin select tin INTO inp from base where rownum=1; insert into restst select * from table(sdo_tin_pkg.clip_tin ( inp,  Input TIN object sdo_geometry(2003, null, null, mdsys.sdo_elem_info_array(1, 1003, 3), mdsys.sdo_ordinate_array(175.86157, 14.60521, 0,0)),  Query null, null)); end; . . .
Format
SDO_TIN_PKG.CREATE_TIN(
inp IN SDO_TIN,
inptable IN VARCHAR2,
clstPcdataTbl IN VARCHAR2 DEFAULT NULL);
Description
Creates a TIN using the points specified in the inptable
parameter.
Parameters
SDO_TIN object to be used. This object must have been created by the SDO_TIN_PKG.INIT function
Name of the table containing the input TIN data. This table 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 highestnumbered dimension. n should match the tin_tot_dimensions
parameter value in the call to the SDO_TIN_PKG.INIT function when the TIN 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.
Usage Notes
The first few dimensions of the TIN are indexed and can later be searched using the SDO_TIN_PKG.CLIP_TIN function. The exact number of dimensions to index is determined by the dimensionality of the TIN extent in the initialized TIN object, specifically: inp.tin_extent.sdo_gtype/1000
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 highestnumbered dimension. n should match the tin_tot_dimensions
parameter value in the call to the SDO_TIN_PKG.INIT function when the TIN 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 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 tin_tot_dimensions
parameter of the SDO_TIN_PKG.INIT function.)
The SDO_TIN data type is described in Section 2.5.
Section 1.11.1 describes how to use TINs to model surfaces.
Examples
The following example creates a TIN. It is taken from the sdo_tin.sql
example program, which is under $ORACLE_HOME
/md/demo/examples/TIN/plsql/
if you installed the files from the Oracle Database Examples media.
. . .  Create the blocks for the TIN. sdo_tin_pkg.create_tin( tin,  Initialized TIN 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) ); / . . .
Format
SDO_TIN_PKG.DROP_DEPENDENCIES(
basetable IN VARCHAR2,
col IN VARCHAR2);
Description
Drops the dependencies between a TIN block table and a specified base table and column.
Parameters
Name of a base table that was specified (in the basetable
parameter of the SDO_TIN_PKG.INIT function) when the TIN was initialized.
Name of a column in base table that was specified in the basecol
parameter of the SDO_TIN_PKG.INIT function.
Usage Notes
This procedure truncates the TIN 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 TIN block table or associate the table with another base table and column combination. For more information, see the Usage Notes for the SDO_TIN_PKG.INIT function.
Examples
The following example drops the dependencies between a TIN block table and a base table and column named BASE and TIN, respectively.
. . . declare begin mdsys.sdo_tin_pkg.drop_dependencies('BASE', 'TIN'); end; /
Format
SDO_TIN_PKG.INIT(
basetable IN VARCHAR2,
basecol IN VARCHAR2,
blktable IN VARCHAR2,
ptn_params IN VARCHAR2 DEFAULT NULL,
tin_extent IN VARCHAR2 DEFAULT NULL,
tin_tol IN NUMBER DEFAULT NULL,
tin_tot_dimensions IN NUMBER DEFAULT NULL,
tin_domain IN SDO_ORGSCL_TYPE DEFAULT NULL,
tin_break_lines IN SDO_GEOMETRY DEFAULT NULL,
tin_stop_lines IN SDO_GEOMETRY DEFAULT NULL,
tin_void_rgns IN SDO_GEOMETRY DEFAULT NULL,
tin_val_attr_tables IN SDO_STRING_ARRAY DEFAULT NULL,
tin_other_attrs IN XMLTYPE DEFAULT NULL,
) RETURN SDO_TIN;
Description
Initializes a TIN by creating an SDO_TIN object.
Parameters
Name of the base table containing a column of type SDO_TIN.
Name of the column of type SDO_TIN in the base table.
Name of the TIN block table, which is used for storing the blocks of the TIN. This table must exist, and must have been created by a statement in the following form: CREATE TABLE <tablename> AS select * from mdsys.sdo_tin_blk_table;
Each TIN block table can only be associated with only one basetable
and basecol
combination.
Parameters for partitioning the TIN, specified as a quoted string with keywords delimited by commas. For example: 'blk_capacity=5,work_tablespace=my_work_ts'
. If this parameter is null, the TIN is not partitioned. The following keywords are permitted:
blk_capacity=n
, where n is the maximum number of rows in each partition. If specified, must be a number greater than 3.
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 TIN (the minimum bounding object enclosing all objects in the TIN. If this parameter is null, the spatial extent geometry is automatically calculated.
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 tin_tot_dimensions
parameter, as explained in the description of that parameter.
Tolerance value for objects in the TIN. (For information about spatial tolerance, see Section 1.5.5.) If this parameter is null, the value is the tolerance associated with the data.
A number specifying the total dimensionality of the TIN object. For each point in the TIN blocks, tin_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 tin_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.
(Not currently used.)
Line string or multiline string SDO_GEOMETRY object representing the break line or lines in the TIN. If this parameter is null, the TIN contains no break lines. Break lines typically represent road networks, cliffs, and ridges.
Line string or multiline string SDO_GEOMETRY object representing the stop line or lines in the TIN. If this parameter is null, the TIN contains no stop lines. Stop lines typically indicate places where the elevation lines are not continuous, such as the slope from the top to the bottom of a cliff. Such regions are to be excluded from the TIN.
Polygon or multipolygon SDO_GEOMETRY object representing planar surfaces that have a constant elevation. If this parameter is null, the TIN contains no void regions.
SDO_STRING_ARRAY object specifying the names of any value attribute tables for the TIN. If this parameter is null, the TIN has no associated value attribute tables. Type STO_STRING_ARRAY is defined as VARRAY(1048576) OF VARCHAR2(32).
XMLTYPE object specifying any other attributes of the TIN. If this parameter is null, the TIN has no other attributes.
Usage Notes
After you use this function to create an SDO_TIN object, you can create a TIN by specifying this object as input to the SDO_TIN_PKG.CREATE_TIN procedure.
The SDO_TIN data type is described in Section 2.5.
Section 1.11.1 describes how to use TINs to model surfaces.
Examples
The following example initializes a TIN by creating an SDO_TIN object. It is taken from the sdo_tin.sql
example program, which is under $ORACLE_HOME
/md/demo/examples/TIN/plsql/
if you installed the files from the Oracle Database Examples media.
declare tin sdo_tin; begin  Initialize the TIN object. tin := sdo_tin_pkg.init( 'BASE',  Table that has the SDO_TIN column defined 'TIN',  Column name of the SDO_TIN object 'BLKTAB',  Table to store blocks of the TIN 'blk_capacity=6000',  max # of points per block mdsys.sdo_geometry(2003, null, null, mdsys.sdo_elem_info_array(1,1003,3), mdsys.sdo_ordinate_array(180, 90, 180, 90)),  Extent 0.0000000005,  Tolerance for TIN 3,  Total number of dimensions null); . . .
Format
SDO_TIN_PKG.TO_GEOMETRY(
pts IN BLOB,
trs IN BLOB,
num_pts IN NUMBER,
num_trs IN NUMBER,
tin_tot_dim IN NUMBER,
srid IN NUMBER DEFAULT NULL,
blk_domain IN SDO_ORGSCL_TYPE DEFAULT NULL
) RETURN SDO_GEOMETRY;
Description
Returns a geometry object representing all or part of a TIN.
Parameters
BLOB containing points.
BLOB containing triangles.
Maximum number of points to be included in the resulting geometry.
Maximum number of triangles 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.)
Usage Notes
This function returns a single collection SDO_GEOMETRY object that represents all point geometries in the pts
parameter and all triangle geometries in the trs
parameter. For example, the points and triangles could reflect the result of a clip operation or the contents of an entire block.
Section 1.11.1 describes how to use TINs to model surfaces.
Examples
The following example returns a multipoint collection geometry object representing a TIN. It is taken from the sdo_tin.sql
example program, which is under $ORACLE_HOME
/md/demo/examples/TIN/plsql/
if you installed the files from the Oracle Database Examples media.
. . .  Return points in blk_id of the TIN as a multipoint collection. select sdo_tin_pkg.to_geometry( a.points,  point LOB a.triangles,  point LOB a.num_points,  # of points in the LOB a.num_triangles,  # of points in the LOB 2,  index dimensionality (gtype dim in extent in INIT) 3,  total dimensionality null  SRID ) from blktab a where blk_id=0; . . .