## T_GEOMETRY/CONSTRUCTORS [ Modules ]

[ Top ] [ Modules ]

NAME

```    A collection of T_GEOMETRY Constructors.
```

SOURCE

```  Constructor Function T_GEOMETRY  (p_geom      in mdsys.sdo_geometry)
Return Self As Result,
Constructor Function T_GEOMETRY  (p_geom      in mdsys.sdo_geometry,
p_tolerance in number)
Return Self As Result,
Constructor Function T_GEOMETRY  (p_geom      in mdsys.sdo_geometry,
p_tolerance in number,
p_precision in integer)
Return Self As Result,
Constructor Function T_GEOMETRY  (p_geom      in mdsys.sdo_geometry,
p_tolerance in number,
p_precision in integer,
p_projected in varchar2)
Return Self As Result,
Constructor Function T_GEOMETRY  (p_vertex    in mdsys.vertex_type,
p_srid      in integer,
p_tolerance in number default 0.05)
Return Self As Result,
Constructor Function T_GEOMETRY  (p_vector    in &&INSTALL_SCHEMA..T_Vector,
p_srid      in integer,
p_tolerance in number default 0.05,
p_precision in integer default 2,
p_projected in varchar2 default 'PLANAR')
Return Self As Result,
```

## T_GEOMETRY/orderBy [ Methods ]

[ Top ] [ Methods ]

NAME

```    orderBy -- Implements ordering function that can be used to sort a collection of T_GEOMETRY objects.
```

SYNOPSIS

```    Order Member Function orderBy(p_compare_geom in &&INSTALL_SCHEMA..T_GEOMETRY)
Return Number deterministic
```

INPUTS

```    p_compare_geom (T_GEOMETRY) - Order pair
```

DESCRIPTION

```    This order by function allows a collection of T_GEOMETRY objects to be sorted.
For example in the ORDER BY clause of a SELECT statement. Comparison uses all ordinates: X, Y, Z and W.
```

EXAMPLE

```  With geometries as (
select t_geometry(sdo_geometry(2001,null,
sdo_point_type(dbms_random.value(0,level),
dbms_random.value(0,level),
null),
null,null),
0.05,
3,
1) as tgeom
from dual
connect by level < 10
)
select a.tgeom.st_astext(2) as sGeom
from geometries a
order by a.tgeom;

SGEOM
------------------------------------------------------------------------------------------
T_GEOMETRY(SDO_GEOMETRY(2001,NULL,SDO_POINT_TYPE(0.39,0.87,NULL),NULL,NULL);TOLERANCE(.05)
T_GEOMETRY(SDO_GEOMETRY(2001,NULL,SDO_POINT_TYPE(0.71,0.04,NULL),NULL,NULL);TOLERANCE(.05)
T_GEOMETRY(SDO_GEOMETRY(2001,NULL,SDO_POINT_TYPE(1.68,1.03,NULL),NULL,NULL);TOLERANCE(.05)
T_GEOMETRY(SDO_GEOMETRY(2001,NULL,SDO_POINT_TYPE(1.72,1.45,NULL),NULL,NULL);TOLERANCE(.05)
T_GEOMETRY(SDO_GEOMETRY(2001,NULL,SDO_POINT_TYPE(2.68,1.99,NULL),NULL,NULL);TOLERANCE(.05)
T_GEOMETRY(SDO_GEOMETRY(2001,NULL,SDO_POINT_TYPE(3.12,1.14,NULL),NULL,NULL);TOLERANCE(.05)
T_GEOMETRY(SDO_GEOMETRY(2001,NULL,SDO_POINT_TYPE(3.38,0.71,NULL),NULL,NULL);TOLERANCE(.05)
T_GEOMETRY(SDO_GEOMETRY(2001,NULL,SDO_POINT_TYPE(4.75,4.46,NULL),NULL,NULL);TOLERANCE(.05)
T_GEOMETRY(SDO_GEOMETRY(2001,NULL,SDO_POINT_TYPE(5.49,6.87,NULL),NULL,NULL);TOLERANCE(.05)

9 rows selected
```

RESULT

```    order value (NUMBER) - -1 less than; 0 equal; 1 greater than
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/PI [ Functions ]

[ Top ] [ Functions ]

NAME

```    PI -- Returns constant PI value.
```

SYNOPSIS

```    Static Function PI
Return Number
```

DESCRIPTION

```    This function exposes static constant PI.
```

EXAMPLE

```    SELECT T_GEOMETRY.PI()
FROM DUAL;

T_GEOMETRY.PI()
---------------------------------------
3.1415926535897932384626433832795028842
```

RESULT

```    PI (NUMBER) - eg 3.14....
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

[ Top ] [ Methods ]

NAME

```    ST_Add_Vector -- Adds a vector to an existing geometry.
```

SYNOPSIS

```    Member Function ST_Add_Vector     (p_vector in &&INSTALL_SCHEMA..T_Vector)
Return &&INSTALL_SCHEMA..T_Geometry deterministic,
```

DESCRIPTION

```    Adds a vector to an existing geometry.
If last vertex of existing geometry equals first vertex of vector the point is not repeated.
Supports vectors that define a circular arc.
```

INPUTS

```    p_vector (T_VECTOR) - Valid vector. Supports 2 vertex or 3 vertex circular arc vectors.
```

RESULT

```    geometry (T_GEOMETRY) - Modified geometry
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_AsText [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_AsText -- Returns text Description of T_GEOMETRY
```

SYNOPSIS

```    Member Function ST_AsText(p_linefeed in integer default 1)
Return CLOB Deterministic,
```

DESCRIPTION

```    Returns textual description of T_GEOMETRY.
Rounds ordinates via object precision variable.
```

INPUTS

```    p_linefeed (integer) - 1 if apply linefeed to coordinates
```

RESULT

```    textual description (string)
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_Buffer [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_Buffer -- Creates a buffer around input geometry.
```

SYNOPSIS

```    Member Function ST_Buffer(p_distance in number,
p_unit     in varchar2 default null)
Return &&INSTALL_SCHEMA..T_GEOMETRY deterministic
```

DESCRIPTION

```    This function creates a square buffer around all linestrings in an object.
A negative buffer is not possible.
```

INPUTS

```    p_distance (NUMBER)   - Value > 0.0
p_unit     (VARCHAR2) - Unit of measure for distance calculations.
```

RESULT

```    polygon (T_GEOMETRY) - Result of buffering input geometry.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_Centroid [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_Centroid -- Creates a centroid for any mdsys.sdo_geometry object.
```

SYNOPSIS

```    Member Function ST_Centroid(p_option in varchar2 := 'LARGEST',
p_unit   in varchar2 default null)
Return &&INSTALL_SCHEMA..T_GEOMETRY deterministic
```

DESCRIPTION

```    This function creates a single centroid if the line-string being operated on
has a single part. The position of the centroid is either the mid-length point
if the line is not measured, or the mid-measure position if measured. For a single
line-string any supplied p_option value is ignored.
If the geometry is a multi-linestring a number of options are available.
- LARGEST  -- Returns centroid of largest (measure/length) line-string in multi-linestring (DEFAULT)
- SMALLEST -- Returns centroid of smallest (measure/length) line-string in multi-linestring
- MULTI    -- Returns all centroid for all parts of multi-linestring as a single multi-point (x005 gtype) geometry.
The centroid of each part is constructed using the same rules as for a single line-string.
```

INPUTS

```    p_option (VARCHAR2) - LARGEST, SMALLEST, or MULTI. Ignored if single linestring.
p_unit   (VARCHAR2) - Unit of measure for distance calculations.
```

RESULT

```    point (T_GEOMETRY) - Centroid of input object.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_Concat_Line (1.0) [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_Concat_Line -- Adds supplied linestring to start/end of underlying linestring depending on geometric relationship.
```

DESCRIPTION

```   Joins two linestrings together depending on start/end relationships of the supplied
linestring and the underlying linestring.
Does not support point or polygon geometries.
```

INPUTS

```    p_line (SDO_GEOMETRY) - Geometry to be added to underlying mdsys.sdo_geometry.
```

RESULT

```    linestring (T_GEOMETRY) - Line that is the result of concatenating the two linestrings.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original Coding.
```

## T_GEOMETRY/ST_CoordDim [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_CoordDim -- Executes, and returns, result of mdsys.sdo_geometry method ST_CoordDim().
```

SYNOPSIS

```    Member Function ST_CoordDim
Return INTEGER Deterministic,
```

DESCRIPTION

```    Is a wrapper over the mdsys.sdo_geometry method SELF.GEOM.ST_CoordDim(). Returns Coordinate Dimension of mdsys.sdo_geometry object.
```

RESULT

```    Coordinate Dimension (SMALLINT) -- 2 if 2001; 3 is 3001 etc.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_DB_Version [ Functions ]

[ Top ] [ Functions ]

NAME

```    ST_DB_Version -- Returns Database Version and sub version.
```

SYNOPSIS

```    Static Function ST_DB_Version
Return Number
```

DESCRIPTION

```    This function return database version which is useful when handling Oracle functions that only appear in certain versions
```

EXAMPLE

```    SELECT T_GEOMETRY.ST_DB_Version()
FROM DUAL;

T_GEOMETRY.ST_DB_Version()
--------------------------
11.2
```

RESULT

```    Database Version (NUMBER) - eg 11.2 Database(12.1)
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - May 2016 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_Dims [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_Dims -- Returns number of ordinate dimensions
```

SYNOPSIS

```    Member Function ST_Dims
Return INTEGER Deterministic,
```

DESCRIPTION

```    Is a wrapper over the mdsys.sdo_geometry get_dims() method ie SELF.GEOM.Get_Dims()
```

RESULT

```    dimension (INTEGER) -- 2 if data 2D; 3 if 3D; 4 if 4D
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_Distance [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_Distance -- Returns distance from current T_geometry (SELF) to supplied T_GEOMETRY.
```

SYNOPSIS

```    Member Function ST_Distance(p_geom in &&INSTALL_SCHEMA..T_GEOMETRY,
p_unit in varchar2 default NULL)
Return Number Deterministic
```

INPUTS

```    p_geom  (T_GEOMETRY) - A T_GEOMETRY to which a distance is calculated.
p_unit    (VARCHAR2) - Oracle Unit of Measure eg unit=M.
```

DESCRIPTION

```    This function computes a distance from the current object (SELF) to the supplied T_Geometry.
Result is in the distance units of the SDO_SRID, or in p_units where supplied.
```

RESULT

```    distance (Number) -- Distance in SRID unit of measure or in supplied units (p_unit)
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_Dump [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_Dump -- Extracts all parts of a multipart linestring, polygon, or collection geometry.
```

SYNOPSIS

```    Member Function ST_Dump(p_subElements IN integer Default 0)
Return &&INSTALL_SCHEMA..T_Geometries Pipelined
```

DESCRIPTION

```    Extracts all parts of an underlying geometry object.
If p_subElemets is set to TRUE (1), all subElements of a complex element
(eg compound outer ring of polygon) are extracted and returned as mdsys.sdo_geometry objects.
Individual sdo_gemetry objects are returned in a T_GEOMROW structure that has three fields: GID, GEOMETRY and TOLERANCE.
GID values are generated in the order the elements appears in the sdo_elem_info structure.
```

EXAMPLE

```    with GEOMETRIES as (
select t_geometry(
mdsys.sdo_geometry(2007,null,null,
sdo_elem_info_array( 1,1003,1,11,2003,1,21,2003,1,
31,1005,2,31,2,1,37,2,2,43,1003,3),
sdo_ordinate_array(0,0, 20,0, 20,20, 0,20, 0,0, 10,10, 10,11, 11,11, 11,10, 10,10, 5,5, 5,7, 7,7, 7,5, 5,5,
110,128, 110,125, 120,125, 120,128, 115,130, 110,128,112,0, 113,10))
,0.05,3,1) as tPolygon
From dual
)
GID GEOMETRY                                                                                                      TOLERANCE
--- --------------------------------------------------------------------------------------------------------      ---------
1 mdsys.sdo_geometry(2003,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,2,1),SDO_ORDINATE_ARRAY(0,0,20,0,20,20,0,20,0,0,10,10))          0.05
2 mdsys.sdo_geometry(2003,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,2,1),SDO_ORDINATE_ARRAY(10,10,10,11,11,11,11,10,10,10,5,5))      0.05
3 mdsys.sdo_geometry(2003,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,2,1),SDO_ORDINATE_ARRAY(5,5,5,7,7,7,7,5,5,5))                    0.05
1 mdsys.sdo_geometry(2003,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,2,1),SDO_ORDINATE_ARRAY(110,128,110,125,120,125,120,128))        0.05
2 mdsys.sdo_geometry(2003,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,2,2),SDO_ORDINATE_ARRAY(120,128,115,130,110,128))                0.05
1 mdsys.sdo_geometry(2003,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,2,3),SDO_ORDINATE_ARRAY(112,0,113,10))                           0.05

6 rows selected
```

RESULT

```    Geometry (T_GEOMROW) -- Table (T_GEOMETRIES) of T_GEOMROW objects.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_ElemInfo [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_ElemInfo -- Returns underlying mdsys.sdo_geometry's SDO_ELEM_INFO array as a Set of T_ElemInfo objects.
```

SYNOPSIS

```    Member Function ST_ElemInfo
Return &&INSTALL_SCHEMA..T_ElemInfoSet pipelined
```

DESCRIPTION

```    If a geometry is coded with an SDO_ELEM_INFO_ARRAY this function will extract the triplets that describe
each element and returns them as a set of T_ELEM_INFO objects.
The T_ElemInfo object is:
CREATE TYPE &&INSTALL_SCHEMA..T_ElemInfo AS OBJECT (
offset           NUMBER,
etype            NUMBER,
interpretation   NUMBER
);
```

RESULT

```    Set of T_ElemInfo objects (INTEGER)
NOTE
Function is pipelined
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2006 - Original coding in GEOM package.
Simon Greener - Jan 2013 - Port to T_GEOMETRY object.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_Equals [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_Equals -- Compares current object (SELF) with supplied T_GEOMETRY.
```

SYNOPSIS

```    Member Function ST_Equals(p_tgeometry in &&INSTALL_SCHEMA..T_Geometry)
Return Integer deterministic
```

INPUTS

```    p_tygeoemtry (T_GEOMETRY) - T_GEOEMTRY that is to be compared to current object (SELF).
```

DESCRIPTION

```    This function compares current t_geometry object (SELF) to supplied p_tgeometry object.
Only compares SDO_GEOMETRY objects.
```

RESULT

```    BOOLEAN (INTEGER) - 1 is True (Equal); 0 is False.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - July 2017 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_ExtractRings [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_ExtractRings -- Extracts all rings of a polygon/multipolygon into a set of simple T_GEOMETRY polygon objects.
```

SYNOPSIS

```    Member Function ST_ExtractRings()
Return &&INSTALL_SCHEMA..T_GEOMETRIES Pipelined
```

DESCRIPTION

```    This function allows a user to extract all outer and inner rings from a polygon/multipolygon. The resultant set of
individual inner or outer rings are accessible via the Oracle SQL TABLE function as in the example below.
```

EXAMPLE

```    With geometries As (
Select T_GEOMETRY(sdo_geometry('POLYGON((0 0,20 0,20 20,0 20,0 0),(10 10,10 11,11 11,11 10,10 10),(5 5,5 7,7 7,7 5,5 5))',null),
0.05,3,1) as tPolygon
From dual
)
Select a.tPolygon.ST_ExtractRings(10).geom as fGeom
From geometries a;

FGEOM
------------------------------------------------------------------------------------------------------
mdsys.sdo_geometry(2003,null,null,sdo_elem_info_array(1,1003,1),sdo_ordinate_array(0,0,20,0,20,20,0,20,0,0))
```

RESULT

```    polygon (T_GEOMETRY) -- With rings whose area < p_are removed.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_FilterRings [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_FilterRings -- Removes rings from polygon/multipolygon below supplied area.
```

SYNOPSIS

```    Member Function ST_FilterRings(p_area in number,
p_unit in varchar2 default null)
Return &&INSTALL_SCHEMA..T_GEOMETRY Deterministic,
```

INPUTS

```    p_area (Number)   - Area in square SRID units below which an inner ring is removed.
p_unit (VARCHAR2) - Oracle Unit of Measure For SRID eg unit=M.
```

DESCRIPTION

```    This function allows a user to remove inner rings from a polygon/multipolygon based on an area value.
Will remove both outer and inner rings.
```

EXAMPLE

```    With polygons As (
Select T_GEOMETRY(sdo_geometry('POLYGON((0 0,20 0,20 20,0 20,0 0),(10 10,10 11,11 11,11 10,10 10),(5 5,5 7,7 7,7 5,5 5))',null),0.05,3,1) as TGeom
From Dual Union All
Select T_GEOMETRY(sdo_geometry(2007,NULL,NULL,
sdo_elem_info_array(1,1005,2, 1,2,1, 7,2,2,13,1003,3),
sdo_ordinate_array (10,128, 10,125, 20,125, 20,128, 15,130, 10,128, 0,0, 10,10)),0.05,3,1) as TGeom
From Dual
)
Select T.geometry
From polygons a,
Table(a.tGeom.ST_ExtractRings()) t;

GEOMETRY
------------------------------------------------------------------------------------------------------------------------------------
mdsys.sdo_geometry(2003,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,1003,1),SDO_ORDINATE_ARRAY(0,0,20,0,20,20,0,20,0,0))
mdsys.sdo_geometry(2003,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,1003,1),SDO_ORDINATE_ARRAY(10,10,11,10,11,11,10,11,10,10))
mdsys.sdo_geometry(2003,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,1003,1),SDO_ORDINATE_ARRAY(5,5,7,5,7,7,5,7,5,5))
mdsys.sdo_geometry(2003,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,1005,2,1,2,1,7,2,2),SDO_ORDINATE_ARRAY(10,128,10,125,20,125,20,128,15,130,10,128))
mdsys.sdo_geometry(2003,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,1003,3),SDO_ORDINATE_ARRAY(0,0,10,10))
```

RESULT

```    polygon collection (T_GEOMETRIES) -- A set of one or more single rings derived from input polygon.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_GeometryType [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_GeometryType -- Returns underlying mdsys.sdo_geometry's SQLMM Geometry Type.
```

SYNOPSIS

```    Member Function ST_GeometryType
Return VarChar2 Deterministic,
```

DESCRIPTION

```    Is a wrapper over the ST_GEOMETRY ST_GeometryType() method. Returns textual description of the geometry type
eg ST_Polygon for x003 mdsys.sdo_geometry object.
```

RESULT

```    geometry type (INTEGER) -- 1:Point; 2:Linestring; 3:Polygon; 4:Collection; 5:MultiPoint; 6:MultiLinestring; 7:MultiPolygon
```

EXAMPLE

```    With Geometries As (
select T_GEOMETRY(sdo_geometry(2001,NULL,sdo_point_type(10,11,null),null,null),0.05,2,1) as TGEOM
From Dual Union All
Select T_GEOMETRY(sdo_geometry(2002,NULL,NULL,sdo_elem_info_array(1,2,1),sdo_ordinate_array(10,45, 20,45, 23,48, 20,51, 10,51)),0.05,1,1) as TGEOM
From Dual Union All
Select T_GEOMETRY(sdo_geometry(2003,NULL,NULL,sdo_elem_info_array(1,1003,3),sdo_ordinate_array(0,0, 10,10)),0.05,1,1) as TGEOM
From Dual Union All
select t_geometry(sdo_geometry(2003,null,null,sdo_elem_info_array(1,1005,2, 1,2,1, 7,2,2),
SDO_ORDINATE_ARRAY (10,128, 10,125, 20,125, 20,128, 15,130, 10,128)),0.05,2,1) as TGEOM
From Dual Union All
Select T_GEOMETRY(sdo_geometry(2002,null,null,sdo_elem_info_array(1,4,3, 1,2,1, 3,2,2, 7,2,1),
sdo_ordinate_array(10,45, 20,45, 23,48, 20,51, 10,51)),0.05,2,1) as TGEOM
From Dual
)
select a.TGeom.ST_GTYPE() as gtype,
a.TGeom.ST_GeometryType() as Geometrytype
From Geometries a;

GTYPE GEOMETRYTYPE
----- ----------------
1 ST_POINT
2 ST_LINESTRING
3 ST_POLYGON
3 ST_CURVEPOLYGON
2 ST_COMPOUNDCURVE
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_GType [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_GType -- Returns underlying mdsys.sdo_geometry's geometry type by executing mdsys.sdo_geometry method get_gtype().
```

SYNOPSIS

```    Member Function ST_GType
Return INTEGER Deterministic,
```

DESCRIPTION

```    Is a wrapper over the mdsys.sdo_geometry get_gtype() method ie SELF.GEOM.Get_Gtype()
```

RESULT

```    geometry type (INTEGER) -- 1:Point; 2:Linestring; 3:Polygon; 4:Collection; 5:MultiPoint; 6:MultiLinestring; 7:MultiPolygon
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_hasCircularArcs [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_hasCircularArcs -- A function that tests whether underlying mdsys.sdo_geometry contains circular arcs.
```

SYNOPSIS

```    Member Function ST_hasCircularArcs
Return integer Deterministic,
```

DESCRIPTION

```    Examines sdo_elem_info to see if contains ETYPE/Interpretation that describes a circular arc, or even a full circle.
```

RESULT

```    BOOLEAN (INTEGER) -- 1 if has circular arcs.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Dec 2008 - Original coding within GEOM package.
Simon Greener - Jan 2013 - Recoded for T_GEOMETRY.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_hasOptimizedRectangles [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_hasOptimizedRectangles -- A function that tests whether underlying mdsys.sdo_geometry contains optimized rectangles.
```

SYNOPSIS

```    Member Function ST_hasCircularArcs
Return integer Deterministic,
```

DESCRIPTION

```    Examines sdo_elem_info to see if contains ETYPE/Interpretation that describes an optimized rectangle.
eg SDO_ELEM_INFO_ARRAY(1,1003,3) ie the interpretation value of 3 means optimized rectangle.
```

RESULT

```    BOOLEAN (INTEGER) -- 1 if has optimized rectangles.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jun 2011 - Original coding for GEOM package.
Simon Greener - Jan 2013 - Recoded for T_GEOMETRY.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_isMeasured [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_isMeasured -- Tests mdsys.sdo_geometry to see if coordinates include a measure.
```

SYNOPSIS

```    Member Function ST_LRS_isMeasured
Return INTEGER Deterministic,
```

DESCRIPTION

```    Examines SDO_GTYPE (DLNN etc) to see if sdo_gtype has measure ordinate eg 3302 not 3002.
```

RESULT

```    BOOLEAN (INTEGER) -- 1 is measure ordinate exists, 0 otherwise.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_IsValid [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_IsValid -- Executes, and returns, result of mdsys.sdo_geometry method ST_IsValid().
```

SYNOPSIS

```    Member Function ST_IsValid
Return INTEGER Deterministic,
```

DESCRIPTION

```    Is a wrapper over the mdsys.sdo_geometry method SELF.GEOM.ST_IsValid(). See also SDO_GEOM.VALIDATE_GEOMETRY etc.
```

RESULT

```    BOOLEAN (INTEGER) -- If mdsys.sdo_geometry is valid (see SDO_GEOM.VALIDATE_GEOMETRY) returns 1 else 0.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_LineShift (1.0) [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_LineShift -- Moves linestring parallel to imaginary line drawnn from first to last vertex.
```

SYNOPSIS

```    Member Function ST_LineShift(p_distance in number)
Return &&INSTALL_SCHEMA..T_GEOMETRY deterministic
```

DESCRIPTION

```    Function that extracts the first and last vertex of a linestring, compute a snigle fofset at right angles to an imaginary line from first to last vertex, then apply offset to all vertices in the linestring. Is a "simple" versio of the more complex ST_Parallel.
```

INPUTS

```    p_distance (NUMBER)   - Value +/- integer value.
```

NOTES

```    Only supports linestrings.
```

TODO

```    Add support for SRID units of measure (ie parameter p_unit).
```

RESULT

```    geometry (T_GEOMETRY) -- Input linestring moved parallel by p_distance units
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - December 2008 - Original coding in GEOM package.
Simon Greener - January 2013  - Port/Rewrite to T_GEOMETRY object function member.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

[ Top ] [ Methods ]

NAME

```    ST_LRS_Add_Measure -- Adds measures to 2D (multi)linestring.
```

SYNOPSIS

```    Member Function ST_LRS_Add_Measure(p_start_measure IN NUMBER Default NULL,
p_end_measure   IN NUMBER Default NULL,
p_unit          IN VARCHAR2 Default NULL)
Return &&INSTALL_SCHEMA..T_GEOMETRY deterministic,
```

DESCRIPTION

```    Takes a 2D geometry and assigns supplied measures to the start/end vertices
and adds proportioned measure values to all vertices in between.
```

INPUTS

```    p_start_measure (NUMBER)   - Measure defining start point for geometry.
p_end_measure   (NUMBER)   - Measure defining end point for geometry.
p_unit          (VARCHAR2) - Unit of measure for distance calculations.
```

RESULT

```    geometry (T_GEOMETRY) -- Measured geometry
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original Coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_Lrs_Dim [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_Lrs_Dim -- Tests underlying mdsys.sdo_geometry to see if coordinates include a measure ordinate and returns measure ordinate's position.
```

SYNOPSIS

```    Member Function ST_Lrs_Dim
Return INTEGER Deterministic,
```

DESCRIPTION

```    Examines SDO_GTYPE (DLNN etc) measure ordinate position (L) and returns it.
```

RESULT

```    BOOLEAN (INTEGER) -- L from DLNN.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_LRS_End_Measure [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_LRS_End_Measure -- Returns M value of last vertex in measured geometry.
```

SYNOPSIS

```    Member Function ST_LRS_End_Measure
Return &&INSTALL_SCHEMA..T_GEOMETRY Deterministic,
```

DESCRIPTION

```    Returns end measure associated with last vertex in a measured line-string.
If the line-string is not measured it returns the length of the linestring.
```

INPUTS

```    p_unit (VARCHAR2) - Unit of measure for distance calculations.
```

RESULT

```    measure (NUMBER)  - Measure value of first vertex in a measured line-string: 0 if not measured.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original Coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_LRS_Find_Measure [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_LRS_Find_Measure -- Snaps input point to measured linestring returning measure value(s)
```

SYNOPSIS

```    Member Function ST_LRS_Find_Measure(p_geom     in mdsys.sdo_geometry,
p_measureN in integer default 1,
p_unit     in varchar2    default null)
Return mdsys.sdo_ordinate_array Deterministic,
```

DESCRIPTION

```    Given a point near a measured linestring, this function returns the measures
of all lines that have same distance to the linestring.
```

INPUTS

```    p_geom     (MDSYS.SDO_GEOMETRY) - Geometry for which a measure is needed.
p_measureN (INTEGER)            - Particular measure to be returned. 0 = all possible measures, 1 is the first etc.
p_unit     (VARCHAR2)           - Unit of measure for distance calculations.
```

RESULT

```    measure (MDSYS.SDO_ORDINATE_ARRAY) -- All measures where more than one is closest to line.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_LRS_Find_MeasureN [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_LRS_Find_MeasureN -- Returns nominated measure nearest to supplied point if it exists.
```

SYNOPSIS

```    Member Function ST_LRS_Find_MeasureN(p_geom     in mdsys.sdo_geometry,
p_measureN in integer default 1,
p_unit     in varchar2    default null)
Return mdsys.sdo_ordinate_array Deterministic,
```

DESCRIPTION

```    Given a point near a measured linestring, this function returns the nominated
measure nearest to that point if it exists. For example, requesting p_measureN=2
may return NULL if only one measure exists that is closest to the linestring at some point.
```

INPUTS

```    p_geom     (MDSYS.SDO_GEOMETRY) - Geometry for which a measure is needed.
p_measureN (INTEGER)            - Particular measure to be returned. 1..AllPossibleMeasures
p_unit     (VARCHAR2)           - Unit of measure for distance calculations.
```

RESULT

```    measure (NUMBER) - First measure on line closest to point.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_LRS_Find_Offset [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_LRS_Find_Offset -- Returns smallest (perpendicular) offset from supplied point to the linestring.
```

SYNOPSIS

```    Member Function ST_LRS_Find_Offset(p_geom in mdsys.sdo_geometry,
p_unit in varchar2    default null)
Return Number Deterministic,
```

DESCRIPTION

```    Given a point this function returns the smallest (perpendicular) offset from
the point to the line-string.
```

INPUTS

```    p_point (MDSYS.SDO_GEOMETRY) - Point geometry for which a measure is needed.
p_unit  (VARCHAR2)           - Unit of measure for distance calculations.
```

RESULT

```    offset (NUMBER) - Perpendicular offset distance from point to nearest point on line.
Value is negative if on left of line; positive if on right.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_LRS_Get_Measure [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_LRS_Get_Measure -- The function returns the measure of the T_GEOMETRY point object.
```

SYNOPSIS

```    Member Function ST_LRS_Get_Measure
Return number deterministic,
```

DESCRIPTION

```    Returns the measure value of a measured point.
If point 3301, the value of the Z attribute is returned etc.
```

RESULT

```    Measure Value (NUMBER)       - Measure value of point (ie 3301, 4301, 4401). If n001 returns NULL.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - June 2017 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_LRS_Intersection [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_LRS_Intersection -- Intersects input geometry against measured linestring.
```

SYNOPSIS

```    Member Function ST_LRS_Intersection(P_GEOM In Mdsys.Sdo_Geometry,
P_unit in varchar2 default null)
Return t_geometry Deterministic,
```

DESCRIPTION

```    Takes as input a linestring, multi-linestring, polygon, MultiPolygon or point.
SELF must be a measured linestring.
```

INPUTS

```    p_geom   (MDSYS.SDO_GEOMETRY) - Geometry for which a intersection calculation is needed.
p_unit    (VARCHAR2) - Oracle Unit of Measure eg unit=M.
```

RESULT

```    Geometry (T_GEOMETRY) - Measured Linestring or point
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jul 2017 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_LRS_Is_Measure_Decreasing [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_LRS_Is_Measure_Decreasing -- Checks if M values decrease in value over all of the linestring.
```

SYNOPSIS

```    Member Function ST_LRS_Is_Measure_Decreasing
Return varchar2 deterministic,
```

DESCRIPTION

```    Checks all measures of all vertices in a linestring from start to end.
Computes difference between each pair of measures. If all measure differences
decrease then TRUE is returned, otherwise FALSE. For non-measured line-strings
the value is always FALSE.
```

RESULT

```    boolean (VARCHAR2) - TRUE if measures are decreasing, FALSE otherwise.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original Coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_LRS_Is_Measure_Increasing [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_LRS_Is_Measure_Increasing -- Checks if M values increase in value over all of the linestring.
```

SYNOPSIS

```    Member Function ST_LRS_Is_Measure_Increasing
Return varchar2 deterministic,
```

DESCRIPTION

```    Checks all measures of all vertices in a linestring from start to end.
Computes difference between each pair of measures. If all measure differences
increase then TRUE is returned, otherwise FALSE. For non-measured line-strings
the value is always TRUE.
```

RESULT

```    boolean (VARCHAR2) -- TRUE if measures are increasing, FALSE otherwise.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original Coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_LRS_Is_Shape_Pt_Measure [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_LRS_Is_Shape_Pt_Measure -- Checks if M values increase in value over all of the linestring.
```

SYNOPSIS

```    Member Function ST_LRS_Is_Shape_Pt_Measure(p_measure in number)
Return varchar2 deterministic,
```

DESCRIPTION

```    Checks all measures of all vertices in a linestring from start to end to see
if a measure on a shape vertex has the same measure value as p_measure.
Uses measure increasing/decreasing to avoid having to test all vertices in linestring.
```

RESULT

```    boolean (VARCHAR2) -- TRUE if measure exists at a shape vertex.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - JanJuly7 - Original Coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_LRS_Locate_Along [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_LRS_Locate_Along -- Wrapper over ST_LRS_Locate_Measure
```

SYNOPSIS

```    Member Function ST_LRS_Locate_Along(p_measure in number,
p_offset  in number   default 0,
p_unit    in varchar2 default null)
Return &&INSTALL_SCHEMA..T_GEOMETRY deterministic
```

INPUTS

```    p_measure (NUMBER)   - Measure defining point to be located.
p_offset  (NUMBER)   - Offset value left (negative) or right (positive) in p_units.
p_unit    (VARCHAR2) - Unit of measure for distance calculations when defining snap point
```

RESULT

```    point (T_GEOMETRY) - Point at measure/offset.
```

```    ST_Locate_Measure(p_measure in number, ...)
```

## T_GEOMETRY/ST_LRS_Locate_Between [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_LRS_Locate_Between -- Converts supplied measures into single point or linestring.
```

DESCRIPTION

```    Wrapper over ST_LRS_Locate_Between
```

INPUTS

```    p_start_measure (NUMBER)   - Measure defining start point of located geometry.
p_end_measure   (NUMBER)   - Measure defining end point of located geometry.
p_offset        (NUMBER)   - Offset value left (negative) or right (positive) in p_units.
p_unit          (VARCHAR2) - Unit of measure for distance calculations when defining snap point
```

RESULT

```    point (T_GEOMETRY) - Point or Line between start/end measure with offset.
```

```    ST_Locate_Measures(p_start_measure in number, ...)
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original Coding.
```

## T_GEOMETRY/ST_LRS_Locate_Measure [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_LRS_Locate_Measure -- Returns point geometry at supplied measure along linestring.
```

SYNOPSIS

```    Member Function ST_LRS_Locate_Measure (p_measure in number,
p_offset  in number   default 0,
p_unit    in varchar2 default null)
Return &&INSTALL_SCHEMA..T_GEOMETRY deterministic,
```

DESCRIPTION

```    Given a measure or length, this function returns a mdsys.sdo_geometry point
at that measure or offset the supplied amount.
```

NOTES

```    Handles line-strings with reversed measures.
```

INPUTS

```    p_measure (NUMBER)   - Measure defining point to be located.
p_offset  (NUMBER)   - Offset value left (negative) or right (positive) in p_units.
p_unit    (VARCHAR2) - Unit of measure for distance calculations when defining snap point
```

RESULT

```    point (T_GEOMETRY) - Point at measure/offset.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original Coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_LRS_Locate_Measures [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_LRS_Locate_Measures -- Converts supplied measures into single point or linestring.
```

SYNOPSIS

```    Member Function ST_LRS_Locate_Measures(p_start_measure in number,
p_end_measure   in number,
p_offset        in number default 0,
p_unit          varchar2 default null)
Return &&INSTALL_SCHEMA..T_GEOMETRY Deterministic,
```

DESCRIPTION

```    Given two measures or lengths, this function returns the point defined by
those measure (if equal) or a line-string if not. The geometry may be offset
the supplied amount.
```

NOTES

```    Currently does not handle line-strings with reversed measures.
```

INPUTS

```    p_start_measure (NUMBER)   - Measure defining start point of located geometry.
p_end_measure   (NUMBER)   - Measure defining end point of located geometry.
p_offset        (NUMBER)   - Offset value left (negative) or right (positive) in p_units.
p_unit          (VARCHAR2) - Unit of measure for distance calculations when defining snap point
```

RESULT

```    point (T_GEOMETRY) - Point at measure/offset.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original Coding.
```

## T_GEOMETRY/ST_LRS_Locate_Point [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_LRS_Locate_Point -- Wrapper over ST_LRS_Locate_Measure
```

SYNOPSIS

```    Member Function ST_LRS_Locate_Point (p_measure in number,
p_offset  in number default 0)
Return &&INSTALL_SCHEMA..T_GEOMETRY deterministic,
```

DESCRIPTION

```    Given a measure or length, this function returns a mdsys.sdo_geometry point
at that measure or offset the supplied amount.
```

NOTES

```    Handles line-strings with reversed measures.
```

INPUTS

```    p_measure (NUMBER)   - Measure defining point to be located.
p_offset  (NUMBER)   - Offset value left (negative) or right (positive) in p_units.
```

RESULT

```    point (T_GEOMETRY) - Point at measure/offset.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - July 2017 - Original Coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_LRS_Measure_Range [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_LRS_Measure_Range -- Returns Last Vertex M Value - First Vertex M Value.
```

SYNOPSIS

```    Member Function ST_LRS_Measure_Range(p_unit in varchar2 default null)
Return Number deterministic,
```

DESCRIPTION

```    Returns end vertex measure value - start vertex measure value.
If line-string not measured, returns length of line.
```

INPUTS

```    p_unit (VARCHAR2) - Unit of measure for distance calculations.
```

RESULT

```    measure (NUMBER) -- Measure range for measured line-string: length if not measured.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original Coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_LRS_Measure_To_Percentage [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_LRS_Measure_To_Percentage -- Converts supplied M value to percentage of M range.
```

SYNOPSIS

```    Member Function ST_LRS_Measure_To_Percentage(p_measure IN NUMBER DEFAULT 0,
p_unit    in varchar2 default null)
Return Number deterministic,
```

DESCRIPTION

```    The end measure minus the start measure of a measured line-string defines
the range of the measures (see ST_Measure_Range). The supplied measure is
divided by this range and multiplied by 100 to return the measure as a percentage.
For non measured line-strings all values are computed using lengths.
```

INPUTS

```    p_percentage (NUMBER)   - Value between 0 and 100
p_unit       (VARCHAR2) - Unit of measure for distance calculations.
```

RESULT

```    Percentage (NUMBER) - Value between 0 and 100.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original Coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_LRS_Percentage_To_Measure [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_LRS_Percentage_To_Measure -- Converts supplied Percentage value to Measure.
```

SYNOPSIS

```    Member Function ST_LRS_Percentage_To_Measure(p_percentage IN NUMBER DEFAULT 0,
p_unit       in varchar2 default null)
Return Number deterministic,
```

DESCRIPTION

```    The supplied percentage value (between 0 and 100) is multipled by
the measure range (see ST_Measure_Range) to return a measure value between
the start and end measures. For non measured line-strings all values are
computed using lengths.
```

INPUTS

```    p_percentage (NUMBER)   - Value between 0 and 100
p_unit       (VARCHAR2) - Unit of measure for distance calculations.
```

RESULT

```    Measure (NUMBER) - Value between Start Measure and End Measure.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original Coding.
```

## T_GEOMETRY/ST_LRS_Project_Point [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_LRS_Project_Point -- The function uses ST_Snap to snap a point to a linestring(2002) or multi-linestring (2006).
```

SYNOPSIS

```    Member Function ST_LRS_Project_Point(P_Point In Mdsys.Sdo_Geometry,
p_unit  In varchar2 Default null)
Return &&INSTALL_SCHEMA..T_GEOMETRY deterministic,
```

DESCRIPTION

```    This is a wrapper function for ST_Snap. The function uses ST_Snap to snap a point
to a linestring(2002) or multi-linestring (2006).
However, where ST_Snap may return more than one result point if p_point was
equidistant from two separate vectors/segments of the line-string, ST_Project_Point
returns the first.
```

INPUTS

```    p_point (MDSYS.SDO_GEOMETRY) - A point(2001) mdsys.sdo_geometry object describing the point for splitting the linestring.
p_unit  (VARCHAR2)           - Unit of measure for distance calculations.
```

RESULT

```    snapped_points (T_GEOMETRIES) -- One or more points where supplied point has snapped to the linestring.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_LRS_Reset_Measure [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_LRS_Reset_Measure -- Wipes all existing assigned measures.
```

SYNOPSIS

```    Member Function ST_LRS_Reset_Measure
Return &&INSTALL_SCHEMA..T_GEOMETRY Deterministic,
```

DESCRIPTION

```    Sets all measures of a measured linesting to null values leaving sdo_gtype
alone. So, 3302 remains 3302, but all measures are set to NULL eg
Coord 2 of 10.23,5.75,2.65 => 10.23,5.75,NULL
```

NOTES

```    This is not the same as ST_To2D which removes measures etc and returns a pure 2D (200x object).
```

RESULT

```    linestring (T_GEOMETRY) -- All measures reset
```

AUTHOR

```    Simon Greener
```

HISTORY

```     Simon Greener - Jan 2013 - Original Coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_LRS_Reverse_Measure [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_LRS_Reverse_Measure -- Reverses vertices measures: first becomes last, second becomes second last etc.
```

SYNOPSIS

```    Member Function ST_LRS_Reverse_Measure
Return &&INSTALL_SCHEMA..T_GEOMETRY Deterministic,
```

DESCRIPTION

```    Reverses vertices measures: first becomes last, second becomes second last etc.
This is not the same as ST_Reverse_Linestring which reverses xy direction of whole linestring.
```

RESULT

```    linestring (T_GEOMETRY) - All measures reversed
```

AUTHOR

```    Simon Greener
```

HISTORY

```     Simon Greener - Jan 2013 - Original Coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_LRS_Scale_Measures [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_LRS_Scale_Measures -- Rescales geometry measures and optionally offsets them, stretching the geometry.
```

SYNOPSIS

```    Member Function ST_LRS_Scale_Measures
Return &&INSTALL_SCHEMA..T_GEOMETRY Deterministic,
```

DESCRIPTION

```    This function can redistribute measure values between the supplied
p_start_measure (start vertex) and p_end_measure (end vertex) by adjusting/scaling
the measure values of all in between coordinates. In addition, if p_shift_measure
is not 0 (zero), the supplied value is added to each modified measure value
performing a translation/shift of those values.
```

INPUTS

```    p_start_measure (NUMBER) - Measure defining start point for geometry.
p_end_measure   (NUMBER) - Measure defining end point for geometry.
p_shift_measure (NUMBER) - Unit of measure for distance calculations.
RETURN
linestring (T_GEOMETRY) - All measures scales.
```

AUTHOR

```    Simon Greener
```

HISTORY

```     Simon Greener - Jan 2013 - Original Coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_LRS_Start_Measure [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_LRS_Start_Measure -- Returns M value of first vertex in measured geometry.
```

SYNOPSIS

```    Member Function ST_LRS_Start_Measure
Return &&INSTALL_SCHEMA..T_GEOMETRY Deterministic,
```

DESCRIPTION

```    Returns start measure associated with first vertex in a measured line-string.
If the line-string is not measured it returns 0.
```

RESULT

```    measure (NUMBER) -- Measure value of first vertex in a measured line-string: 0 if 2D.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original Coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_LRS_Valid_Geometry [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_LRS_Valid_Geometry -- Checks if underlying LRS linestring is valid.
```

SYNOPSIS

```    Member Function ST_LRS_Valid_Geometry(p_diminfo in mdsys.sdo_dim_array)
Return varchar2 Deterministic,
```

DESCRIPTION

```    Function returns TRUE string if underlying linestring is a valid LRS linestring and FALSE otherwise.
The supplied SDO_DIM_ARRAY must have measure information with a SDO_DIMNAME of M (uppercase)
This function checks that the geometry type is measured eg 3302 and has the right number of dimensions (dL0N)
The function also checks that sdo_ordinate array has measure values within the range of the supplied diminfo structure.
```

INPUTS

```    p_diminfo (mdsys.sdo_dim_array) - DIMINFO structure with a measure sdo_dim_element
TOBEDONE
Current implementation does NOT examine the supplied diminfo array.
```

RESULT

```    TRUE/FASE (string) - TRUE if LRS linestring is Valid, FALSE otherwise.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2017 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_LRS_Valid_Measure [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_LRS_Valid_Measure -- Checks if supplied measure falls within the linestring's measure range.
```

SYNOPSIS

```    Member Function ST_LRS_Valid_Measure(p_measure in number)
Return varchar2 Deterministic,
```

DESCRIPTION

```    Function returns TRUE string if measure falls within the underlying linestring's measure range
or the FALSE string if the supplied measure does not fall within the measure range.
```

INPUTS

```    p_measure (number) - Measure value.
```

RESULT

```    TRUE/FASE (string) - TRUE if measure within range, FALSE otherwise.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2017 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_LRS_Valid_Point [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_LRS_Valid_Point -- Checks if underlying LRS point is valid.
```

SYNOPSIS

```    Member Function ST_LRS_Valid_Point(p_diminfo in mdsys.sdo_dim_array)
Return varchar2 Deterministic,
```

DESCRIPTION

```    Function returns TRUE string if point is valid and FALSE if point is not valid.
A valid LRS point has measure information. It is checkeds for the geometry type
(point) and the number of dimensions.
The Oracle equivalent for this function requires that "All LRS point data must be
stored in the SDO_ELEM_INFO_ARRAY and SDO_ORDINATE_ARRAY, and cannot be stored in
the SDO_POINT field in the SDO_GEOMETRY definition of the point", however, this
implementation allows for the storage of 3301 Points within the SDO_POINT_TYPE structure.
```

INPUTS

```    p_diminfo (mdsys.sdo_dim_array) - DIMINFO structure with a measure sdo_dim_element
TOBEDONE
Current implementation does NOT examine the supplied diminfo array.
```

RESULT

```    TRUE/FASE (string) - TRUE if LRS POint is Valid, FALSE otherwise.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2017 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_LRS_Valid_Segment [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_LRS_Valid_Segment -- Checks if underlying LRS linestring is valid.
```

SYNOPSIS

```    Member Function ST_LRS_Valid_Segment(p_diminfo in mdsys.sdo_dim_array)
Return varchar2 Deterministic,
```

DESCRIPTION

```    Function returns TRUE string if underlying linestring is a valid LRS linestring and FALSE otherwise.
The supplied SDO_DIM_ARRAY must have measure information with a SDO_DIMNAME of M (uppercase)
This function only checks that the geometry type is measured eg 3302 and the linestring dims (dL0N)
```

INPUTS

```    p_diminfo (mdsys.sdo_dim_array) - DIMINFO structure with a measure sdo_dim_element
TOBEDONE
Current implementation does NOT examine the supplied diminfo array.
```

RESULT

```    TRUE/FASE (string) - TRUE if LRS linestring is Valid, FALSE otherwise.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2017 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_NumElem [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_NumELems -- Returns number of top level elements of the underlying mdsys.sdo_geometry.
```

SYNOPSIS

```    Member Function ST_NumElem()
Return Number Deterministic
```

DESCRIPTION

```    Wrapper over SDO_UTIL.GETNUMELEM().
```

EXAMPLE

```    With GEOMETRIES As (
Select T_GEOMETRY(sdo_geometry(2007,NULL,NULL,sdo_elem_info_array (1,1005,2, 1,2,1, 7,2,2,13,1003,3),
sdo_ordinate_array (10,128, 10,125, 20,125, 20,128, 15,130, 10,128, 0,0, 10,10)),0.05,3,1) as TGEOM
From Dual Union All
Select T_GEOMETRY(sdo_geometry(2002,NULL,NULL,sdo_elem_info_array (1,4,3, 1,2,1, 3,2,2, 7,2,1),
sdo_ordinate_array (10,45, 20,45, 23,48, 20,51, 10,51)),0.05,3,1) as TGEOM
From Dual
)
Select a.TGEOM.ST_NUMELEM() as NumElem
From GEOMETRIES a;

NUMELEM
-------
2
1
```

RESULT

```    Required Element Count (INTEGER)
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2006 - Original coding in GEOM package.
Simon Greener - Jan 2013 - Port to T_GEOMETRY object.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_NumRings [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_NumRings -- Returns Number of Rings of specified type in a polygon/mutlipolygon.
```

SYNOPSIS

```    Member Function ST_NumRings
Return integer Deterministic,
```

DESCRIPTION

```    A polygon can have a single outer ring with no inner rings (holes) or it can have holes.
A multipolygon can have multiple outer rings each with/without inner rings.
This method counts the number of rings of the desired type as defined by the input parameter.
```

INPUTS

```    p_ring_type : integer : 0 - Count all (inner and outer) rings; 1 Count only outer rings; 2 - Count only inner rings.
```

RESULT

```    Number Of Rings (INTEGER)
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Dec 2008 - Original coding for GEOM package.
Simon Greener - Jan 2013 - Port to T_GEOMETRY object.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_NumSubELems [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_NumSubELems -- Interprets underlying mdsys.sdo_geometry's SDO_ELEM_INFO array returning either total count of elements or just underlying sub-elements.
```

SYNOPSIS

```    Member Function ST_NumSubElems(p_subArcs in integer default 0)
Return Number Deterministic
```

DESCRIPTION

```    If a geometry is coded with an SDO_ELEM_INFO_ARRAY this function will examine the triplets that describe
each element and returns one of counts depending on the input parameter.
If the input parameter is 0 all elements are counted: For example is a single polygon has a single outer ring (1),
but that ring is coded with vertex-connected and circular-arc segments (2), then 1 + 2 =3 is returned.
If 1 is the supplied input only the number of sub-elements that describe the outer ring are counted and returned.
```

EXAMPLE

```    With geometries as (
select t_geometry(sdo_geometry(2003,null,null,
sdo_elem_info_array (1,1005,2, 1,2,1, 7,2,2),
sdo_ordinate_array (10,128, 10,125, 20,125, 20,128, 15,130, 10,128)),
0.05,3,1) as tgeom
from dual
union all
select t_geometry(sdo_geometry(2002,null,null,
sdo_elem_info_array (1,4,3, 1,2,1, 3,2,2, 7,2,1),
sdo_ordinate_array (10,45, 20,45, 23,48, 20,51, 10,51)),
0.05,3,1) as tgeom
from dual
)
select a.tgeom.ST_GType() as gType,
a.tgeom.ST_NumSubElems(0) as allElems,
a.tgeom.ST_NumSubElems(1) as lowElems,
a.tgeom.ST_NumSubElems(0) - a.tgeom.ST_NumSubElems(1) as TopElems
from geometries a;

GTYPE   ALLELEMS   LOWELEMS   TOPELEMS
---------- ---------- ---------- ----------
3          3          2          1
2          4          3          1
```

RESULT

```    Required Element Count (INTEGER)
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2006 - Original coding in GEOM package.
Simon Greener - Jan 2013 - Port to T_GEOMETRY object.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_NumVertices [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_NumVertices -- Returns number of vertices (coordinates) in underlying mdsys.sdo_geometry.
```

SYNOPSIS

```    Member Function ST_NumVertices()
Return Integer Deterministic,
```

DESCRIPTION

```    This function is a wrapper over MdSys.SDO_Util.GetNumVertices(). Returns number of vertices (coordinates) that describe the underlying mdsys.sdo_geometry.
```

EXAMPLE

```    With Geometries As (
Select T_GEOMETRY(sdo_geometry('POLYGON((0 0,20 0,20 20,0 20,0 0),(10 10,10 11,11 11,11 10,10 10),(5 5,5 7,7 7,7 5,5 5))',null),0.05,3,1) as TPolygon
From Dual
)
select a.TPolygon.ST_NumVertices() as numVertices
from GEOMETRIES a;

NUMVERTICES
-----------
15
```

RESULT

```    number of vertices (Integer) -- For example, if Point(2001), returns 1.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_OneSidedBuffer [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_OneSidedBuffer -- Creates a square buffer to left or right of a linestring.
```

SYNOPSIS

```    Member Function ST_OneSidedBuffer(p_distance in number,
p_curved   in number default 0,
p_unit     in varchar2 default null)
Return &&INSTALL_SCHEMA..T_GEOMETRY deterministic
```

DESCRIPTION

```    This function creates a square buffer to left or right of a linestring.
```

INPUTS

```    p_distance (NUMBER)   - if < 0 then left side buffer; if > 0 then right sided buffer.
p_curved   (NUMBER)   - 0 = no; 1 = yes for angles in linestring (See ST_Parallel)
p_unit     (VARCHAR2) - Unit of measure for distance calculations.
```

RESULT

```    polygon (T_GEOMETRY) - Result of one sided buffering of a linestring.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_Ord2SdoPoint [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_Ord2SdoPoint -- Changes point encoding from SDO_ELEM_INFO_ARRAY/SDO_ORDINATE_ARRAY to SDO_POINT_TYPE.
```

SYNOPSIS

```   Function ST_Ord2SdoPoint
Return &&INSTALL_SCHEMA..T_GEOMETRY Deterministic
```

DESCRIPTION

```    Converts underlying point encoded in SDO_ELEM_INFO_ARRAY/SDO_ORDINATE_ARRAY
elements to one encoded in SDO_POINT_TYPE element.
Gives precidence to measure where exists and point is 4D.
```

RESULT

```    SELF (TO_GEOMETRY) -- Oridinal Point with structure changed.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener, Jul 2017 - New Method.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_Parallel (1.0) [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_Parallel -- Moves linestring parts of underlying Geometry left (-ve) or right (+ve)  depending of distance value.
```

SYNOPSIS

```    Member Function ST_Parallel(p_distance in number,
p_unit     in varchar2 default null)
Return &&INSTALL_SCHEMA..T_GEOMETRY deterministic
```

DESCRIPTION

```    Function that moves the linestring components of the underlying mdsys.sdo_geometry left/right by a fixed amount.
Bends in the linestring, when moved, can remain vertex-connected or be converted to curves.
Does not handle situations where supplied distance results in a segment disappearing.
```

INPUTS

```    p_distance (NUMBER)   - Value +/- integer value.
p_curved   (INTEGER)  - Boolean flag (1/0) indicating whether to stroke bends in line (1=stroke;0=leave alone) when moving segments in direction of obtuse angle.
p_unit     (VARCHAR2) - Unit of measure for distance calculations.
```

RESULT

```    geometry (T_GEOMETRY) -- Input geometry moved parallel by p_distance units
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - December 2008 - Original coding in GEOM package.
Simon Greener - January 2013  - Port/Rewrite to T_GEOMETRY object function member.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_ParallelSimple (1.0) [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_ParallelSimple
```

DESCRIPTION

```    Function under development to replace ST_Parallel do not use.
```

## T_GEOMETRY/ST_ParallelSimpleZ (1.0) [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_ParallelSimpleZ
```

DESCRIPTION

```    Function under development to replace ST_Parallel do not use.
```

## T_GEOMETRY/ST_Rectangle (1.0) [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_Rectangle -- Creates a rectangle polygon around all point objects within the underlying mdsys.sdo_geometry.
```

SYNOPSIS

```    Member Function ST_Rectangle(p_length in number,
p_width  in number)
Return &&INSTALL_SCHEMA..T_GEOMETRY deterministic,
```

DESCRIPTION

```    Function that creates a rectangle/polygon geometry around each point in the underlying point/multipoint mdsys.sdo_geometry. As there is no angle parameter, the rectangles are oriented to the XY axes. If the rectangles need to be rotated, consider using ST_Rotate until such time that this function is modified to support angles.
```

INPUTS

```    p_length (NUMBER)   - +ve value that describes the longest side of the retangle.
p_width  (NUMBER)   - +ve value that describes the shortest side of the retangle.
```

NOTES

```    Only supports point or multipoint geometries.
If geometry is measured, measure will be lost.
```

TODO

```    Add support for rotating the rectangles by adding a p_angle and a p_unit parameter.
```

RESULT

```    geometry (T_GEOMETRY) -- (Multi)Polygon geometry where all input vertices are converted to rectangles.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - January 2013  - Original Coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_Release [ Functions ]

[ Top ] [ Functions ]

NAME

```    ST_Release -- Returns Version Number for the code in the type.
```

SYNOPSIS

```    Static Function ST_Release
Return VarChar2
```

DESCRIPTION

```    This function returns a version or release number for the code when distributed.
Also includes versions of the databases the code was developed against .
```

EXAMPLE

```    SELECT T_GEOMETRY.ST_Release()
FROM DUAL;

T_GEOMETRY.ST_Release()
-----------------------
2.1.1 Databases(11.2, 12.1)
```

RESULT

```    Code Release Number (VARCHAR2) - eg 2.2.1 Databases(11.2, 12.1)
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - June 2017 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_Reverse_Linestring [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_Reverse_Linestring -- Reverses linestring including multi-linestring.
```

SYNOPSIS

```    Member Function ST_Reverse_Linestring
Return T_GEOMETRY Deterministic,
```

DESCRIPTION

```    Reverses linestring including multi-linestring. Honours circular arcs and measures.
```

RESULT

```    linestring (T_GEOMETRY) -- Reverse of input Linestring.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_RoundOrdinates [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_RoundOrdinates -- Rounds X,Y,Z and w ordinates to passed in precision.
```

SYNOPSIS

```    Member Function ST_RoundOrdinates(p_dec_places_x in integer default null,
p_dec_places_y in integer default null,
p_dec_places_z in integer default null,
p_dec_places_w in integer default null)
Return &&INSTALL_SCHEMA..T_Vertex Deterministic,
```

DESCRIPTION

```    Applies relevant decimal digits of precision value to ordinates of mdsys.sdo_geometry.
For example:
SELF.x := ROUND(SELF.x,p_dec_places_x);
```

INPUTS

```    p_dec_places_x (integer) - value applied to x Ordinate.
p_dec_places_y (integer) - value applied to y Ordinate.
p_dec_places_z (integer) - value applied to z Ordinate.
p_dec_places_w (integer) - value applied to w Ordinate.
```

RESULT

```    geometry (T_GEOMETRY)
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_SDO_GType [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_SDO_GType -- Returns underlying mdsys.sdo_geometry's SDO_GTYPE attribute.
```

SYNOPSIS

```    Member Function ST_SDO_GType
Return INTEGER Deterministic,
```

DESCRIPTION

```    Is a wrapper over the mdsys.sdo_geometry SELF.GEOM.SDO_GTYPE attribute.
```

RESULT

```    geometry type (INTEGER) -- eg 2001 for 2D single point etc.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_SdoPoint2Ord [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_SdoPoint2Ord -- Changes point encoding from SDO_POINT_TYPE to SDO_ELEM_INFO_ARRAY/SDO_ORDINATE_ARRAY.
```

SYNOPSIS

```   Function ST_SdoPoint2Ord
Return &&INSTALL_SCHEMA..T_GEOMETRY Deterministic
```

DESCRIPTION

```    Converts underlying Point encoded in SDO_POINT_TYPE structure to one
encoded in sdo_elem_info_array/sdo_ordinate_array elements.
Honours any measure
```

RESULT

```    SELF (TO_GEOMETRY) -- Oridinal Point with structure changed.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener, Jan 2013 - Port to Object method.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_SetPrecision [ Functions ]

[ Top ] [ Functions ]

NAME

```    ST_SetPrecision -- Sets precision property value of object after construction.
```

SYNOPSIS

```    Member Procedure ST_SetPrecision (p_precision in integer default 3),
```

DESCRIPTION

```    The precision object property is normally set when the object is constructed.
This member function allows the user to change the value dynamically.
```

INPUTS

```    p_precision : integer : Any valid integer value for the Oracle ROUND function.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jun 2017 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_SetProjection [ Functions ]

[ Top ] [ Functions ]

NAME

```    ST_SetProjection -- Sets projected property of object after query of MDSYS CS metadata.
```

SYNOPSIS

```    Member Procedure ST_SetProjection  (SELF in out &&INSTALL_SCHEMA..T_GEOMETRY),
```

DESCRIPTION

```    The projected object property is used by the methods of the T_GEOMETRY object
when executing SDO functions that require knowledge of whether the mdsys.sdo_geometry is
coordinate system is projected or geodetic. If the property is not set by a constructor,
on instantiation, this function can be used to set that property at any time.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_SetSdoGtype [ Functions ]

[ Top ] [ Functions ]

NAME

```    ST_SetSdoGtype -- Sets SDO_GTYPE for underlying geometry object.
```

SYNOPSIS

```    Member Function ST_SetSdoGtype (p_sdo_gtype in integer),
```

DESCRIPTION

```    If the SDO_GTYPE property is not set by a constructor on instantiation,
this Function can be used to set that property at any time.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jul 2017 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_SetSRID [ Functions ]

[ Top ] [ Functions ]

NAME

```    ST_SetSRID -- Sets SDO_SRID for underlying geometry object.
```

SYNOPSIS

```    Member Function ST_SetSRID (SELF in out &&INSTALL_SCHEMA..T_GEOMETRY),
```

DESCRIPTION

```    If the SDO_SRID property is not set by a constructor on instantiation,
this Function can be used to set that property at any time.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jul 2017 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_SetTolerance [ Functions ]

[ Top ] [ Functions ]

NAME

```    ST_SetTolerance -- Sets tolerance value of object after construction.
```

SYNOPSIS

```    Member Procedure ST_SetTolerance (p_tolerance in integer default 0.05),
```

DESCRIPTION

```    The tolerance object property is normally set when the object is constructed.
This member function allows the user to change the value dynamically.
```

INPUTS

```    p_tolerance : number : Any valid Oracle Spatial tolerance. Default is 5cm as per geodetic value.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jun 2017 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_SmoothTile (1.0) [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_SmoothTile -- Smoothly polygon created from raster to vector conversion
```

SYNOPSIS

```    Member Function ST_SmoothTile
Return &&INSTALL_SCHEMA..T_GEOMETRY deterministic
```

DESCRIPTION

```    A polygon created from raster to vector conversion, will have many vertices falling
along the same straight line. And whose sides will be "stepped".
This function removes coincident points on a side so that a side will be defined by
only a start and end vertex. The stepped sies will be replaced with vertices in the midpoint of each step
so that any consistent stepped side will be replaced by a single line.
```

NOTES

```    Only supports polygons and multipolygons.
```

RESULT

```    geometry (T_GEOMETRY) -- Grid shaped polygon replaced by polygons with straight sides.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - January 2013 - Original Coding
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_Snap [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_Snap -- The function snaps a point to a linestring(2002) or multi-linestring (2006).
```

SYNOPSIS

```    Member Function ST_Snap (p_point in mdsys.sdo_geometry,
p_unit  in varchar2 default null)
Return &&INSTALL_SCHEMA..T_GEOMETRIES Deterministic,
```

DESCRIPTION

```    The function snaps a point to a linestring(2002) or multi-linestring (2006).
More than one result point may be returned if p_point was equidistant from two
separate vectors/segments of the line-string.
```

INPUTS

```    p_point (MDSYS.SDO_GEOMETRY) - A point(2001) mdsys.sdo_geometry object describing the
point for splitting the linestring.
p_unit  (VARCHAR2) - Unit of measure for distance calculations.
```

RESULT

```    snapped_points (T_GEOMETRIES) -- One or more points where supplied point has snapped to the linestring.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_Split [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_Split -- Splits linestring or multi-linestring object at closest point on linestring to supplied T_Vertex.
```

SYNOPSIS

```    Member Function ST_Split (p_vertex in &&INSTALL_SCHEMA..T_Vertex,
p_unit   in varchar2 default null)
Return &&INSTALL_SCHEMA..T_GEOMETRIES Deterministic,
```

DESCRIPTION

```    Using supplied point, this function splits a linestring or multi-linestring object
at its closest point on linestring. Since the closest point may occur more than once,
multiple linestrings may be returned. Normally the point should lie on the linestring at
a vertex or between two vertices but the algorithm used will split a line even if
the point does not lie on the line. Where the point does not lie on the linestring
the algorithm approximates the nearest point on the linestring to the supplied point
and splits it there: the algorithm is ratio based and will not necessarily be accurate
for geodetic data. The function supports linestrings with circular arcs.
```

INPUTS

```    p_point (MDSYS.SDO_GEOMETRY) - A point(2001) mdsys.sdo_geometry object describing the point for splitting the linestring.
p_unit  (VARCHAR2)           - Unit of measure for distance calculations.
```

RESULT

```    geometry (T_GEOMETRIES) - One or more geometry objects.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_Split (Measure Overload) [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_Split -- Splits linestring or multi-linestring object at measure point.
```

SYNOPSIS

```    Member Function ST_Split (p_measure in number,
p_unit    in varchar2  DEFAULT null)
Return &&INSTALL_SCHEMA..T_GEOMETRY Deterministic,
```

DESCRIPTION

```    Wrapper member function allowing split point to be determined by a measure
```

```    ST_Split(p_vetex in T_VERTEX...);
```

INPUTS

```    p_measure (NUMBER)   - Measure defining split point.
p_unit    (VARCHAR2) - Unit of measure for distance calculations.
```

RESULT

```    geometry (T_GEOMETRIES) - One or more geometry objects.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Apr 2014 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_Split (SDO_GEOMETRY Overload) [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_Split -- Splits linestring or multi-linestring object at closest point on linestring to supplied point mdsys.sdo_geometry.
```

SYNOPSIS

```    Member Function ST_Split (p_point in mdsys.sdo_geometry,
p_unit  in varchar2 DEFAULT null)
Return &&INSTALL_SCHEMA..T_GEOMETRIES Deterministic,
```

DESCRIPTION

```    Wrapper member function allowing mdsys.sdo_geometry 2001 point rather than T_Vertex.
```

```    ST_Split(p_vertex in T_VERTEX...);
```

INPUTS

```    p_point (MDSYS.SDO_GEOMETRY) - A point used to split the linestring.
p_unit  (VARCHAR2)           - Unit of measure for distance calculations.
```

RESULT

```    geometry (T_GEOMETRIES) - One or more geometry objects.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2014 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_Split_Vectors [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_Split_Vectors -- Splits geometry at nearest point on the geometry to supplied vertex.
```

SYNOPSIS

```    Member Function ST_Split_Vectors(p_vertex in &&INSTALL_SCHEMA..T_Vertex,
p_unit   in varchar2    DEFAULT null,
p_pairs  in integer DEFAULT 0)
Return &&INSTALL_SCHEMA..T_Vectors Deterministic,
```

DESCRIPTION

```    Using supplied vertex, the geometry is split at the nearest point on the geometry.
Normally the vertex should lie on the linestring at a specific vertex or between two
vertices but the algorithm used will split a line even if the supplied vertex does not
lie on the line. Where the point does not lie on the linestring the algorithm approximates
the nearest point on the linestring to the supplied point and splits it there.
Where a linestring splits an existing vector between two vertices, two halfs of the vector
are returned. If the split point is at an exact vertex the vector before and after are returned.
If the linestring is split at the start, the previous vector returned is null, and for the end
point the second vector returns is null. Two vectors are always returned.
Since the closest point may occur more than once because the supplied vertex is perfectly between
two line-string vectors all possible results are returned. The first pair occurs earlier in the
linestring than the later ones.
If p_pairs is set to 0, only the first split vectors are returned.
The algorithm is ratio based and will not necessarily be accurate for geodetic data.
The function supports linestrings with circular arcs.
```

INPUTS

```    p_vertex (T_VERTEX) - A vertex point used to split the linestring.
p_unit   (VARCHAR2) - Unit of measure for distance calculations.
p_pairs  (INTEGER)  - 0 : Return first split point's vectors if more than one exists;
1 : Return all split point vectors.
```

RESULT

```    vectors (T_VECTORS) - One or more vector objects.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
DEPRECATED
April 30th. Use ...
```

## T_GEOMETRY/ST_Split_Vectors (SDO_GEOMETRY Overload) [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_Split_Vectors -- Splits geometry at nearest point to supplied mdsys.sdo_geometry 2001 point.
```

SYNOPSIS

```    Member Function ST_Split_Vectors  (p_point in mdsys.sdo_geometry,
p_unit  in varchar2    DEFAULT null,
p_pairs in integer DEFAULT 0)
Return &&INSTALL_SCHEMA..T_Vectors Deterministic,
```

DESCRIPTION

```    Wrapper member function allowing mdsys.sdo_geometry 2001 point rather than T_Vertex.
```

```    ST_Split_Vectors(p_vertex t_vertex...);
```

INPUTS

```    p_point (MDSYS.SDO_GEOMETRY) - A point used to split the linestring.
p_unit  (VARCHAR2)           - Unit of measure for distance calculations.
p_pairs (INTEGER)            - 0 : Return first split point's vectors if more than one exists;
1 : Return all split point vectors.
```

RESULT

```    vectors (T_VECTORS) - One or more vector objects.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
DEPRECATED
April 30th. Use ....
```

## T_GEOMETRY/ST_SquareBuffer [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_SquareBuffer -- Creates a square buffer around (multi)linestrings.
```

SYNOPSIS

```    Member Function ST_SquareBuffer(p_distance in number,
p_curved   in number default 0,
p_unit     in varchar2 default null)
Return &&INSTALL_SCHEMA..T_GEOMETRY deterministic
```

DESCRIPTION

```    This function creates a square buffer around all linestrings in an object.
A negative buffer is not possible.
```

INPUTS

```    p_distance (NUMBER)   - value > 0.0
p_curved   (NUMBER)   - 0 = no; 1 = yes for angles in linestring (See ST_Parallel)
p_unit     (VARCHAR2) - Unit of measure for distance calculations.
```

RESULT

```    polygon (T_GEOMETRY) - Result of square buffering linestrings
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_SRID [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_SRID -- Returns underlying mdsys.sdo_geometry's SDO_SRID attribute.
```

SYNOPSIS

```    Member Function ST_SRID
Return INTEGER Deterministic,
```

DESCRIPTION

```    Is a wrapper over the mdsys.sdo_geometry SELF.GEOM.SDO_SRID attribute.
```

RESULT

```    spatial reference id (INTEGER) -- eg 8311 etc.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_To2D [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_To2D -- Converts underlying 3D or 4D mdsys.sdo_geometry to 2D (xy).
```

SYNOPSIS

```    Member Function ST_To2D
Return &&INSTALL_SCHEMA..T_GEOMETRY Deterministic
```

DESCRIPTION

```    This Function checks if underlying mdsys.sdo_geometry is 2D and returns unchanged.
If mdsys.sdo_geometry has more than xy ordinates (ie xyz or xym or xyzm) the geometry
is stripped of its non-xy ordinates, returning a 2D mdsys.sdo_geometry with only XY ordinates.
```

RESULT

```    SELF (TO_GEOMETRY) -- With 2D Underlying mdsys.sdo_geometry.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Albert Godfrind, July 2006, Original Coding
Bryan Hall,      July 2006, Modified to handle points
Simon Greener,   July 2006, Integrated into geom with GF.
Simon Greener,   Aug  2009, Removed GF; Modified Byan Hall's version to handle compound elements.
Simon Greener,   Jan 2013 - Port to Object method.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_To3D [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_To3D -- Converts underlying 2D or 4D geometry to a 3D geometry.
```

SYNOPSIS

```    Member Function ST_To3D(p_start_z IN NUMBER,
p_end_z   IN NUMBER,
p_unit    IN varchar2 default null)
Return &&INSTALL_SCHEMA..T_GEOMETRY Deterministic
```

DESCRIPTION

```    If underlying mdsys.sdo_geometry object is a 2D line, it converts it to 3D with suypplied start and end measures.
If mdsys.sdo_geometry is 4D it is reduced to 3D with measures reset to supplied start and end values ie result is XYW.
```

RESULT

```    SELF (TO_GEOMETRY) -- 3D mdsys.sdo_geometry line encoded with start and end measures.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener,   May 2007 Original coding in GEOM package.
Simon Greener,   Aug 2009 Added support for interpolating Z values
Simon Greener,   Jan 2013 - Port to Object method.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_To3D [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_To3D -- Converts underlying 2D or 4D geometry to a 3D geometry.
```

SYNOPSIS

```    Member Function ST_To3D (p_zordtokeep IN INTEGER)
Return &&INSTALL_SCHEMA..T_GEOMETRY Deterministic
```

DESCRIPTION

```    This Function checks if underlying mdsys.sdo_geometry is 2D, converts it to 3D with NULL Z ordinates.
If mdsys.sdo_geometry is 4D it is reduced to 3D with p_zordtokeep indicating which non-2D ordinate
to keep eg if 4 then result is XYW; if 3 then XYZ.
```

RESULT

```    SELF (TO_GEOMETRY) -- 3D Underlying mdsys.sdo_geometry.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener,   May 2007 Original coding in GEOM package.
Simon Greener,   Aug 2009 Added support for interpolating Z values
Simon Greener,   Jan 2013 - Port to Object method.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_To3D [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_FixZ -- Replaces and measure/elevation NULL values with supplied value eg -9999
```

SYNOPSIS

```    Member Function ST_FixZ(p_default_z IN NUMBER := -9999 )
Return &&INSTALL_SCHEMA..T_GEOMETRY Deterministic
```

DESCRIPTION

```    It is not uncommon to see linear geometries having a Z or W/M value encoded as NULL while others have numeric values.
This function allows for the replacement of the NULL values with a provided value.
```

RESULT

```    SELF (TO_GEOMETRY) -- Corrected mdsys.sdo_geometry object.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener,   May 2007 Original coding in GEOM package.
Simon Greener,   Aug 2009 Added support for interpolating Z values
Simon Greener,   Jan 2013 - Port to Object method.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_Vectorize [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_Vectorize -- Extracts all vectors from the underlying linear or polygon geometry.
```

SYNOPSIS

```    Member Function ST_Vectorize()
Return &&INSTALL_SCHEMA..T_Vectors Pipelined
```

DESCRIPTION

```    Extracts all vectors from the underlying linear or polygon geometry, and outputs them as a pipelined set of T_Vector objects.
This function honours the underlying structure of the geometry and handles circular curve elements.
```

EXAMPLE

```    With geometries As (
Select T_GEOMETRY(sdo_geometry('POLYGON((0 0,20 0,20 20,0 20,0 0),(10 10,10 11,11 11,11 10,10 10),(5 5,5 7,7 7,7 5,5 5))',null),
0.05,3,1) as tPolygon
From dual
)
Select t.ST_AsText(2)
from GEOMETRIES a,
Table(a.tPolygon.ST_Vectorize()) t;

T.ST_ASTEXT(2)
-------------------------------------
T_Vertex(0,0,NULL,NULL,1,2001,NULL)
T_Vertex(20,0,NULL,NULL,2,2001,NULL)
T_Vertex(20,20,NULL,NULL,3,2001,NULL)
T_Vertex(0,20,NULL,NULL,4,2001,NULL)
T_Vertex(0,0,NULL,NULL,5,2001,NULL)
T_Vertex(10,10,NULL,NULL,6,2001,NULL)
T_Vertex(10,11,NULL,NULL,7,2001,NULL)
T_Vertex(11,11,NULL,NULL,8,2001,NULL)
T_Vertex(11,10,NULL,NULL,9,2001,NULL)
T_Vertex(10,10,NULL,NULL,10,2001,NULL)
T_Vertex(5,5,NULL,NULL,11,2001,NULL)
T_Vertex(5,7,NULL,NULL,12,2001,NULL)
T_Vertex(7,7,NULL,NULL,13,2001,NULL)
T_Vertex(7,5,NULL,NULL,14,2001,NULL)
T_Vertex(5,5,NULL,NULL,15,2001,NULL)

15 rows selected
```

RESULT

```    Vectors (T_VECTOR) -- Table (T_VECTORS) of T_VECTOR objects.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_Vertices [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_Vertices -- Extracts all vertices of the underlying geometry, and outputs them as a pipelined set of T_Vertex objects.
```

SYNOPSIS

```    Member Function ST_Vertices()
Return &&INSTALL_SCHEMA..T_VERTICES Pipelined
```

DESCRIPTION

```    This function allows a user to extract all the vertices of the underlying geometry as a set of T_VERTEX objects.
```

EXAMPLE

```    With geometries As (
Select T_GEOMETRY(sdo_geometry('POLYGON((0 0,20 0,20 20,0 20,0 0),(10 10,10 11,11 11,11 10,10 10),(5 5,5 7,7 7,7 5,5 5))',null),
0.05,3,1) as tPolygon
From dual
)
Select t.ST_AsText(2)
from GEOMETRIES a,
Table(a.tPolygon.ST_Vertices()) t;

T.ST_ASTEXT(2)
-------------------------------------
T_Vertex(0,0,NULL,NULL,1,2001,NULL)
T_Vertex(20,0,NULL,NULL,2,2001,NULL)
T_Vertex(20,20,NULL,NULL,3,2001,NULL)
T_Vertex(0,20,NULL,NULL,4,2001,NULL)
T_Vertex(0,0,NULL,NULL,5,2001,NULL)
T_Vertex(10,10,NULL,NULL,6,2001,NULL)
T_Vertex(10,11,NULL,NULL,7,2001,NULL)
T_Vertex(11,11,NULL,NULL,8,2001,NULL)
T_Vertex(11,10,NULL,NULL,9,2001,NULL)
T_Vertex(10,10,NULL,NULL,10,2001,NULL)
T_Vertex(5,5,NULL,NULL,11,2001,NULL)
T_Vertex(5,7,NULL,NULL,12,2001,NULL)
T_Vertex(7,7,NULL,NULL,13,2001,NULL)
T_Vertex(7,5,NULL,NULL,14,2001,NULL)
T_Vertex(5,5,NULL,NULL,15,2001,NULL)

15 rows selected
```

RESULT

```    vertices (T_VERTICES) -- Table of T_Vertex objects.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_Which_Side [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_Which_Side -- Returns the side the supplied point lies on.
```

SYNOPSIS

```    Member Function ST_Which_Side(p_point in mdsys.sdo_geometry,
p_unit  in varchar2 default null)
Return &&INSTALL_SCHEMA..T_GEOMETRY Deterministic,
```

DESCRIPTION

```    Given a point this function returns the side the point lies on.
Wrapper over ST_Find_Offset
```

```    ST_Find_Offset(p_point in mdsys.sdo_geometry...);
```

INPUTS

```    p_point (MDSYS.SDO_GEOMETRY) - Point geometry for which a measure is needed.
p_unit  (VARCHAR2)           - Unit of measure for distance calculations.
```

RESULT

```    side (VARCHAR2) - L if negative offset; R is positive offset; O if on line.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_WKB [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_WKB -- Exports mdsys.sdo_geometry object to its Well Known Binary (WKB) representation by executing, and returning, result of mdsys.sdo_geometry method get_wkb().
```

SYNOPSIS

```    Member Function ST_WKB
Return INTEGER Deterministic,
```

DESCRIPTION

```    Is a wrapper over the mdsys.sdo_geometry method SELF.GEOM.GET_WKB(). Returns Well Known Binary representation of underlying mdsys.sdo_geometry.
```

RESULT

```    WKB (BLOB) -- eg Well Known Binary encoding of mdsys.sdo_geometry object.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/ST_WKT [ Methods ]

[ Top ] [ Methods ]

NAME

```    ST_WKT -- Exports mdsys.sdo_geometry object to its Well Known Text (WKT) representation by executing, and returning, result of mdsys.sdo_geometry method get_wkt().
```

SYNOPSIS

```    Member Function ST_WKT
Return INTEGER Deterministic,
```

DESCRIPTION

```    Is a wrapper over the mdsys.sdo_geometry method SELF.GEOM.GET_WKT(). Returns Well Known Text representation of underlying mdsys.sdo_geometry.
```

RESULT

```    WKT (CLOB) -- eg Well Known Text encoding of mdsys.sdo_geometry object.
```

AUTHOR

```    Simon Greener
```

HISTORY

```    Simon Greener - Jan 2013 - Original coding.
```

```    (c) 2012-2017 by TheSpatialDBAdvisor/Simon Greener
```

## T_GEOMETRY/TYPE VARIABLES [ Variables ]

[ Top ] [ Variables ]

WARNINGS

```    This type should only be used for programming and should not be stored in the database.
```

DESCRIPTION

```    geom      -- mdsys.sdo_geometry Object
tolerance -- Standard SDO_TOLERANCE value.
Since we need the geometry's tolerance for some operations eg sdo_area etc
let's add it to the type rather than have to supply it all the time to member functions
precision -- Number of Significant Decimal Digits of precision.
Some operations require the comparison of two ordinates. For geodetic data this is
not the same as an Oracle tolerance. We allow a user to supply this value for all data
but if set to null it will assume a value based on the tolerance.
projected -- Whether mdsys.sdo_geometry ordinates are Geodetic (0), Projected (1), or NULL (not defined).
When creating and using bearing and distances one needs to know if the geometry
is projected or not. While one could do this by dynamic query to the database
each time it is needed, an additional property helps us to record this once.
```

SOURCE

```  geom      mdsys.sdo_geometry,
tolerance number,
precision number,
projected integer,
```