Spatial Companion For Oracle (SC4O)

The following package requires the appropriate JAR files to be loaded into the Oracle database JVM. All the required files and installation instructions are available from the package download page. Fill in and submit the form to get access the actual download links.

This package provides access to a bunch of JTS and JASPA functions:

These functions work with point, line and polygon data, except for:

  • ST_PolygonBuilder

which will build polygons from input linestrings (in a resultset).

In addition, there a bunch of aggregate functions (not exposed as Oracle aggregates like sdo_aggr_union due to Oracle sort memory problems):

  • ST_AggrUnionPolygons (implements cascaded union for polygons)
  • ST_AggrUnionMixed (for points, lines or mixed input)

Note that in the package below an additional function is provided with a p_srid parameter. This is because the Java Topology Suite (v 1.12) libraries do not support geodetic/geographic (long/lat) data. If you use the second form, provide the srid of a projected coordinate system in which the actual geoprocessing will occur. The function transforms the supplied geodetic data into that projection, executes the computation, and then transforms the result back to the sdo_srid of p_geom1.

 define defaultSchema='&1'
 WHENEVER SQLERROR EXIT FAILURE;
 CREATE OR REPLACE
 package SC4O
 AUTHID CURRENT_USER
 AS
   TYPE refcur_t IS REF Cursor;  -- SYS_REFCURSOR can also be used
   -- For Buffer, some constants
   --
   CAP_ROUND  CONSTANT NUMBER := 1;
   CAP_BUTT   CONSTANT NUMBER := 2;
   CAP_SQUARE CONSTANT NUMBER := 3;
   JOIN_ROUND CONSTANT NUMBER := 1;
   JOIN_MITRE CONSTANT NUMBER := 2;
   JOIN_BEVEL CONSTANT NUMBER := 3;
   QUADRANT_SEGMENTS CONSTANT NUMBER := 8;
   /** ============================ PROPERTIES ==================================== **/
   /**
   * ST_Area
   * Computes area of supplied geometry.
   *
   * @param p_geom        : sdo_geometry : geometry subject to area calculation
   * @param p_precision   : int : number of decimal places of precision when comparing ordinates.
   * @return number       : Area of geometry
   * @history    : Simon Greener, September 2011, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   */
   FUNCTION ST_Area(p_geom      IN mdsys.sdo_geometry,
                    p_precision IN NUMBER)
     RETURN NUMBER
            Deterministic;
   /**
   * ST_Area
   * Computes area of supplied geodetic geometry.
   * Computations occur in projected space described by p_srid parameter.
   *
   * @param p_geom        : sdo_geometry : geometry subject to area calculation
   * @param p_precision   : int : number of decimal places of precision when comparing ordinates.
   * @param p_srid        : int : SRID of projected space in which actual overlay occurs before
   *                              being projected back to p_geom1.sdo_srid.
   * @return number       : Area of geometry
   * @history    : Simon Greener, September 2011, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   */
   FUNCTION ST_Area(p_geom      IN mdsys.sdo_geometry,
                    p_precision IN NUMBER,
                    p_srid      IN NUMBER)
     RETURN NUMBER
            Deterministic;
   /**
   * ST_Length
   * Computes Length of supplied geometry.
   *
   * @param p_geom        : sdo_geometry : geometry subject to Length calculation
   * @param p_precision   : int : number of decimal places of precision when comparing ordinates.
   * @return  number      : Length of geometry
   * @history    : Simon Greener, September 2011, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   */
   FUNCTION ST_Length(p_geom      IN mdsys.sdo_geometry,
                      p_precision IN NUMBER)
     RETURN NUMBER
            Deterministic;
   /**
   * ST_Length
   * Computes Length of supplied geodetic geometry.
   * Computations occur in projected space described by p_srid parameter.
   *
   * @param p_geom        : sdo_geometry : geometry subject to Length calculation
   * @param p_precision   : int : number of decimal places of precision when comparing ordinates.
   * @param p_srid        : int : SRID of projected space in which actual overlay occurs before
   *                              being projected back to p_geom1.sdo_srid.
   * @return number       : Length of geometry
   * @history    : Simon Greener, September 2011, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   */
   FUNCTION ST_Length(p_geom      IN mdsys.sdo_geometry,
                      p_precision IN NUMBER,
                      p_srid      IN NUMBER)
      RETURN NUMBER
            Deterministic;
   /**
   * ST_Envelope
   * Method for getting MBR or envelope of a geometry object
   *
   * @param p_geom   : sdo_geometry : sdo_geometry object
   * @param p_precision   : int : number of decimal places of precision when comparing ordinates.
   * @return SDO_GEOMETRY : MBR as Polygon
   * @history    : Simon Greener, January 2012, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   */
   FUNCTION ST_Envelope(p_geom      IN mdsys.sdo_geometry,
                        p_precision IN NUMBER)
     RETURN mdsys.sdo_geometry
            deterministic;
   /**
   * ST_MakeEnvelope
   * Method for turning an MBR or envelope into a geometry object (polygon mainly)
   *
   * @param p_minx        : number : minimum x ordinate of MBR
   * @param p_miny        : number : minimum y ordinate of MBR
   * @param p_maxx        : number : maximum x ordinate of MBR
   * @param p_maxx        : number : maximum y ordinate of MBR
   * @param p_srid        : pls_integer : srid of returned geometry
   * @param p_precision   : pls_integer : number of decimal places of precision when comparing ordinates.
   * @return SDO_GEOMETRY : MBR as Polygon
   * @history    : Simon Greener, March 2012, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   */
   FUNCTION ST_MakeEnvelope(p_minx IN NUMBER, p_miny IN NUMBER,
                            p_maxx IN NUMBER, p_maxy IN NUMBER,
                            p_srid IN pls_integer,
                            p_precision IN pls_integer)
     RETURN mdsys.sdo_geometry Deterministic;
   FUNCTION ST_IsValid(p_geom  IN mdsys.sdo_geometry )
     RETURN varchar2 Deterministic;
   FUNCTION ST_IsSimple(p_geom IN mdsys.sdo_geometry )
     RETURN varchar2 Deterministic;
   FUNCTION ST_Dimension(p_geom IN mdsys.sdo_geometry)
     RETURN varchar2 Deterministic;
   FUNCTION ST_CoordDim(p_geom IN mdsys.sdo_geometry)
     RETURN varchar2 Deterministic;
   /** ========================== OVERLAY ======================== **/
   /**
   * ST_Union
   * Unions two geometries together using suppied p_precision to compare coordinates.
   *
   * @param p_geom1       : sdo_geometry : first geometry subject to overlay action
   * @param p_geom2       : sdo_geometry : second geometry subject to overlay action
   * @param p_precision   : int : number of decimal places of precision when comparing ordinates.
   * @param p_distanceTolerance : Number : Optional maximum distance difference (see ST_TopologyPreservingSimplify)
   *                                       for use with simplifying the resultant geometry. Enter 0.0 for no simplification.
   * @return SDO_GEOMETRY : Result of Union
   * @history    : Simon Greener, August 2011, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   */
   FUNCTION ST_Union(p_geom1             IN mdsys.sdo_geometry,
                     p_geom2             IN mdsys.sdo_geometry,
                     p_precision         IN NUMBER)
     RETURN mdsys.sdo_geometry
            Deterministic;
   /**
   * ST_Union
   * Unions two geodetic geometries together using suppied p_precision to compare coordinates.
   * Computations occur in projected space described by p_srid parameter.
   *
   * @param p_geom1       : sdo_geometry : first geometry subject to overlay action
   * @param p_geom2       : sdo_geometry : second geometry subject to overlay action
   * @param p_precision   : int : number of decimal places of precision when comparing ordinates.
   * @param p_srid        : int : SRID of projected space in which actual overlay occurs before
   *                              being projected back to p_geom1.sdo_srid.
   * @return SDO_GEOMETRY : Result of Union
   * @history    : Simon Greener, August 2011, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   */
   FUNCTION ST_Union(p_geom1             IN mdsys.sdo_geometry,
                     p_geom2             IN mdsys.sdo_geometry,
                     p_precision         IN NUMBER,
                     p_srid              IN NUMBER)
     RETURN mdsys.sdo_geometry
            Deterministic;
   /**
   * ST_AggrUnionPolygons
   * Unions a set of sdo_geometry polygons.
   *
   * @param      : p_geomset     : sdo_geometry_array : Collection of SDO_GEOMETRY polygon objects.
   * @param      : p_precision   : int : number of decimal places of precision when comparing ordinates.
   * @param      : p_distanceTolerance : Number : Optional maximum distance difference (see ST_TopologyPreservingSimplify)
   *                                       for use with simplifying the resultant geometry. Enter 0.0 for no simplification.
   * @return     : SDO_GEOMETRY : Result of Union (single or multipolygon)
   * @note       : The underlying JTS code uses planar arithmetic. For long/lat data it is highly recommended that
   *               the geometries in p_geomset are projected into a suitable SRID before calling and then tranformed back
   *               to the original SRID after processing. See example:
   * @example    : select sdo_cs.transform(
   *                        sc4o.ST_AggrUnionPolygons(CAST(COLLECT(sdo_cs.transform(a.geom,32630)) as mdsys.sdo_geometry_array),2,0.5),
   *                        8307) as uGeom
   *                 from provinces a;
   * @history    : Simon Greener, August 2011, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   */
   FUNCTION ST_AggrUnionPolygons(p_geomset           IN mdsys.sdo_geometry_array,
                                 p_precision         IN NUMBER,
                                 p_distanceTolerance IN NUMBER)
     RETURN mdsys.sdo_geometry
            Deterministic;
   /**
   * ST_AggrUnionMixed
   * Unions a set of sdo_geometry objects (can be mix of polygons, lines etc).
   *
   * @param      : p_geomset     : sdo_geometry_array : Collection of SDO_GEOMETRY objects.
   * @param      : p_precision   : int : number of decimal places of precision when comparing ordinates.
   * @param      : p_distanceTolerance : Number : Optional maximum distance difference (see ST_TopologyPreservingSimplify)
   *                                       for use with simplifying the resultant geometry. Enter 0.0 for no simplification.
   * @return     : SDO_GEOMETRY : Result of Union
   * @note       : The underlying JTS code uses planar arithmetic. For long/lat data it is highly recommended that
   *               the geometries in p_geomset are projected into a suitable SRID before calling and then tranformed back
   *               to the original SRID after processing. See example:
   * @example    : select sdo_cs.transform(
   *                        sc4o.ST_AggrUnionMixed(CAST(COLLECT(sdo_cs.transform(a.geom,32630)) as mdsys.sdo_geometry_array),2,0.5),
   *                        8307) as uGeom
   *                 from provinces a;
   * @history    : Simon Greener, August 2011, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   */
   FUNCTION ST_AggrUnionMixed(p_geomset           IN mdsys.sdo_geometry_array,
                              p_precision         IN NUMBER,
                              p_distanceTolerance IN NUMBER)
     RETURN mdsys.sdo_geometry
            Deterministic;
  /**
   * ST_AggrUnionPolygons
   * Unions a result set of sdo_geometry polygons.
   *
   * @param      : p_resultSet   : SC4O.refcur_t or CURSOR : SQL statement defining a ref cursor collection of SDO_GEOMETRY polygon objects.
   * @param      : p_precision   : int : number of decimal places of precision when comparing ordinates.
   * @param      : p_distanceTolerance : Number : Optional maximum distance difference (see ST_TopologyPreservingSimplify)
   *                                       for use with simplifying the resultant geometry. Enter 0.0 for no simplification.
   * @return     : SDO_GEOMETRY : Result of Union (single or multipolygon)
   * @note       : The underlying JTS code uses planar arithmetic. For long/lat data it is highly recommended that
   *               the geometries in p_geomset are projected into a suitable SRID before calling and then tranformed back
   *               to the original SRID after processing. See example:
   * @example    : select sdo_cs.transform(
   *                        sc4o.ST_AggrUnionPolygons(CURSOR(SELECT sdo_cs.transform(b.geom,32630) FROM provinces b),2,0.5),
   *                        8307) as uGeom
   *                 from provinces a;
   * @history    : Simon Greener, August 2011, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   */
   FUNCTION ST_AggrUnionPolygons(p_resultSet         IN &&defaultSchema..SC4O.refcur_t,
                                 p_precision         IN NUMBER,
                                 p_distanceTolerance IN NUMBER)
     RETURN mdsys.sdo_geometry
            Deterministic;
  /**
   * ST_AggrUnionMixed
   * Unions a result set of sdo_geometry objects (can be mix of polygons, lines etc).
   *
   * @param      : p_resultSet   : SC4O.refcur_t or CURSOR : SQL statement defining a ref cursor collection of SDO_GEOMETRY objects.
   * @param      : p_precision   : int : number of decimal places of precision when comparing ordinates.
   * @param      : p_distanceTolerance : Number : Optional maximum distance difference (see ST_TopologyPreservingSimplify)
   *                                       for use with simplifying the resultant geometry. Enter 0.0 for no simplification.
   * @return     : SDO_GEOMETRY : Result of Union
   * @note       : The underlying JTS code uses planar arithmetic. For long/lat data it is highly recommended that
   *               the geometries in p_geomset are projected into a suitable SRID before calling and then tranformed back
   *               to the original SRID after processing. See example:
   * @example    : select sdo_cs.transform(
   *                        sc4o.ST_AggrUnionPolygons(CURSOR(SELECT sdo_cs.transform(b.geom,32630) FROM provinces b),2,0.5),
   *                        8307) as uGeom
   *                 from provinces a;
   * @history    : Simon Greener, August 2011, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   */
   FUNCTION ST_AggrUnionMixed(p_resultSet         IN &&defaultSchema..SC4O.refcur_t,
                              p_precision         IN NUMBER,
                              p_distanceTolerance IN NUMBER)
     RETURN mdsys.sdo_geometry
            Deterministic;
  /**
   * ST_AggrUnionPolygons
   * Unions all sdo_geometry polygon objects in a column of a database objects eg view/table etc.
   *
   * @param      : p_tableName   : varchar2 : name of existing table/view etc whose contents will be unioned.
   * @param      : p_columnName  : varchar2 : Name of sdo_geometry column in p_tableName holding polygons for unioning.
   * @param      : p_precision   : int : number of decimal places of precision when comparing ordinates.
   * @param      : p_distanceTolerance : Number : Optional maximum distance difference (see ST_TopologyPreservingSimplify)
   *                                       for use with simplifying the resultant geometry. Enter 0.0 for no simplification.
   * @return     : SDO_GEOMETRY : Result of Union (single or multipolygon)
   * @note       : The underlying JTS code uses planar arithmetic. For long/lat data it is highly recommended that
   *               the geometries in p_geomset are projected into a suitable SRID before calling and then tranformed back
   *               to the original SRID after processing. See example:
   * @example    : select sdo_cs.transform(sc4o.ST_AggrUnionPolygons('PROVS32630','GEOM',2,0.5),8307) as uGeom
   *                 from dual a;
   * @history    : Simon Greener, August 2011, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   */
   FUNCTION ST_AggrUnionPolygons(p_tableName         IN varchar2,
                                 p_columnName        IN varchar2,
                                 p_precision         IN NUMBER,
                                 p_distanceTolerance IN NUMBER)
     RETURN mdsys.sdo_geometry
            Deterministic;
  /**
   * ST_AggrUnionMixed
   * Unions all sdo_geometry objects (can be mix of polygons, lines etc) in a column of a database object eg view/table etc.
   *
   * @param      : p_tableName   : varchar2 : name of existing table/view etc whose contents will be unioned.
   * @param      : p_columnName  : varchar2 : Name of sdo_geometry column in p_tableName holding polygons for unioning.
   * @param      : p_precision   : int : number of decimal places of precision when comparing ordinates.
   * @param      : p_distanceTolerance : Number : Optional maximum distance difference (see ST_TopologyPreservingSimplify)
   *                                       for use with simplifying the resultant geometry. Enter 0.0 for no simplification.
   * @return     : SDO_GEOMETRY : Result of Union (single or multipolygon)
   * @note       : The underlying JTS code uses planar arithmetic. For long/lat data it is highly recommended that
   *               the geometries in p_geomset are projected into a suitable SRID before calling and then tranformed back
   *               to the original SRID after processing. See example:
   * @example    : select sdo_cs.transform(sc4o.ST_AggrUnionMixed('PROVS32630','GEOM',2,0.5),8307) as uGeom
   *                 from dual a;
   * @history    : Simon Greener, August 2011, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   */
   FUNCTION ST_AggrUnionMixed(p_tableName         IN varchar2,
                              p_columnName        IN varchar2,
                              p_precision         IN NUMBER,
                              p_distanceTolerance IN NUMBER)
     RETURN mdsys.sdo_geometry
            Deterministic;
   /**
   * ST_Difference
   * Computes difference between two geometries using suppied p_precision to compare coordinates.
   *
   * @param p_geom1       : sdo_geometry : first geometry subject to overlay action
   * @param p_geom2       : sdo_geometry : second geometry subject to overlay action
   * @param p_precision   : int : number of decimal places of precision when comparing ordinates.
   * @return SDO_GEOMETRY : Result of Difference
   * @history    : Simon Greener, August 2011, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   */
   FUNCTION ST_Difference(p_geom1     IN mdsys.sdo_geometry,
                          p_geom2     IN mdsys.sdo_geometry,
                          p_precision IN NUMBER)
     RETURN mdsys.sdo_geometry
            Deterministic;
   /**
   * ST_Difference
   * Wrapper Function ST_that enables computation of geometry difference for geodetic (long/lat)
   * geometries.  Computations occur in projected space described by p_srid parameter.
   *
   * @param p_geom1       : sdo_geometry : first geometry subject to overlay action
   * @param p_geom2       : sdo_geometry : second geometry subject to overlay action
   * @param p_precision   : int : number of decimal places of precision when comparing ordinates.
   * @param p_srid        : int : SRID of projected space in which actual overlay occurs before
   *                              being projected back to p_geom1.sdo_srid.
   * @return SDO_GEOMETRY : Result of Difference
   * @history    : Simon Greener, August 2011, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   */
   FUNCTION ST_Difference(p_geom1     IN mdsys.sdo_geometry,
                          p_geom2     IN mdsys.sdo_geometry,
                          p_precision IN NUMBER,
                          p_srid      IN NUMBER)
     RETURN mdsys.sdo_geometry
            Deterministic;
   /**
   * ST_Intersection
   * Computes intersection between two geometries using suppied p_precision to compare coordinates.
   *
   * @param p_geom1       : sdo_geometry : first geometry subject to overlay action
   * @param p_geom2       : sdo_geometry : second geometry subject to overlay action
   * @param p_precision   : int : number of decimal places of precision when comparing ordinates.
   * @return SDO_GEOMETRY : Result of Intersection
   * @history    : Simon Greener, August 2011, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   */
   FUNCTION ST_Intersection(p_geom1     IN mdsys.sdo_geometry,
                            p_geom2     IN mdsys.sdo_geometry,
                            p_precision IN NUMBER)
     RETURN mdsys.sdo_geometry
            Deterministic;
   /**
   * ST_Intersection
   * Wrapper Function ST_that enables computation of geometry intersection for geodetic (long/lat)
   * geometries.  Computations occur in projected space described by p_srid parameter.
   *
   * @param p_geom1       : sdo_geometry : first geometry subject to overlay action
   * @param p_geom2       : sdo_geometry : second geometry subject to overlay action
   * @param p_precision   : int : number of decimal places of precision when comparing ordinates.
   * @param p_srid        : int : SRID of projected space in which actual overlay occurs before
   *                              being projected back to p_geom1.sdo_srid.
   * @return SDO_GEOMETRY : Result of Intersection
   * @history    : Simon Greener, August 2011, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   */
   FUNCTION ST_Intersection(p_geom1     IN mdsys.sdo_geometry,
                            p_geom2     IN mdsys.sdo_geometry,
                            p_precision IN NUMBER,
                            p_srid      IN NUMBER )
     RETURN mdsys.sdo_geometry
            Deterministic;
   /**
   * ST_Xor
   * Computes xor between two geometries using suppied p_precision to compare coordinates.
   *
   * @param p_geom1       : sdo_geometry : first geometry subject to overlay action
   * @param p_geom2       : sdo_geometry : second geometry subject to overlay action
   * @param p_precision   : int : number of decimal places of precision when comparing ordinates.
   * @return SDO_GEOMETRY : Result of Xor
   * @history    : Simon Greener, August 2011, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   */
   FUNCTION ST_Xor(p_geom1     IN mdsys.sdo_geometry,
                   p_geom2     IN mdsys.sdo_geometry,
                   p_precision IN NUMBER)
     RETURN mdsys.sdo_geometry
            Deterministic;
   /**
   * ST_Xor
   * Wrapper Function ST_that enables computation of geometry xor for geodetic (long/lat)
   * geometries.  Computations occur in projected space described by p_srid parameter.
   *
   * @param p_geom1       : sdo_geometry : first geometry subject to overlay action
   * @param p_geom2       : sdo_geometry : second geometry subject to overlay action
   * @param p_precision   : int : number of decimal places of precision when comparing ordinates.
   * @param p_srid        : int : SRID of projected space in which actual overlay occurs before
   *                              being projected back to p_geom1.sdo_srid.
   * @return SDO_GEOMETRY : Result of Xor
   * @history    : Simon Greener, August 2011, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   */
   FUNCTION ST_Xor(p_geom1     IN mdsys.sdo_geometry,
                   p_geom2     IN mdsys.sdo_geometry,
                   p_precision IN NUMBER,
                   p_srid      IN NUMBER)
     RETURN mdsys.sdo_geometry
            Deterministic;
   /**
   * ST_SymDifference (wrapper over Xor)
   * Computes symbolic difference between two geometries using suppied p_precision to compare coordinates.
   *
   * @param p_geom1       : sdo_geometry : first geometry subject to overlay action
   * @param p_geom2       : sdo_geometry : second geometry subject to overlay action
   * @param p_precision   : int : number of decimal places of precision when comparing ordinates.
   * @return SDO_GEOMETRY : Result of SymDifference
   * @history    : Simon Greener, August 2011, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   */
   FUNCTION ST_SymDifference(p_geom1     IN mdsys.sdo_geometry,
                             p_geom2     IN mdsys.sdo_geometry,
                             p_precision IN NUMBER)
     RETURN mdsys.sdo_geometry
            Deterministic;
   /**
   * ST_SymDifference
   * Wrapper Function ST_(over Xor) that enables computation of geometry symbolic difference for geodetic (long/lat)
   * geometries.  Computations occur in projected space described by p_srid parameter.
   *
   * @param p_geom1       : sdo_geometry : first geometry subject to overlay action
   * @param p_geom2       : sdo_geometry : second geometry subject to overlay action
   * @param p_precision   : int : number of decimal places of precision when comparing ordinates.
   * @param p_srid        : int : SRID of projected space in which actual overlay occurs before
   *                              being projected back to p_geom1.sdo_srid.
   * @return SDO_GEOMETRY : Result of SymDifference
   * @history    : Simon Greener, August 2011, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   */
   FUNCTION ST_SymDifference(p_geom1     IN mdsys.sdo_geometry,
                             p_geom2     IN mdsys.sdo_geometry,
                             p_precision IN NUMBER,
                             p_srid      IN NUMBER )
     RETURN mdsys.sdo_geometry
            Deterministic;
   /** ================ Comparisons ================= */
   /**
   * ST_HausdorffSimilarityMeasure
   * Measures the degree of similarity between two sdo_geometrys
   * using JTS's Hausdorff distance metric.
   * The measure is normalized to lie in the range [0, 1].
   * Higher measures indicate a great degree of similarity.
   * <p>
   * The measure is computed by computing the Hausdorff distance
   * between the input geometries, and then normalizing
   * this by dividing it by the diagonal distance across
   * the envelope of the combined geometries.
   *
   * @param p_geom1     : sdo_geometry : first geometry subject to comparison
   * @param p_geom2     : sdo_geometry : second geometry subject to comparison
   * @param p_precision : int : number of decimal places of precision
   * @return     double : Result of comparison
   * @history    : Simon Greener, August 2011, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   **/
   FUNCTION ST_HausdorffSimilarityMeasure(p_geom1     IN mdsys.sdo_geometry,
                                          p_geom2     IN mdsys.sdo_geometry,
                                          p_precision IN NUMBER)
     RETURN NUMBER deterministic;
   /**
   * ST_HausdorffSimilarityMeasure
   * Wrapper. Computations occur in projected space described by p_srid parameter.
   *
   * @param p_geom1     : sdo_geometry : first geometry subject to comparison
   * @param p_geom2     : sdo_geometry : second geometry subject to comparison
   * @param p_precision : int : number of decimal places of precision
   * @param p_srid      : int : SRID of projected space in which actual overlay occurs before
   *                            being projected back to p_geom1.sdo_srid.
   * @return     double : Result of comparison
   * @history    : Simon Greener, August 2011, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   **/
   FUNCTION ST_HausdorffSimilarityMeasure(p_geom1     IN mdsys.sdo_geometry,
                                          p_geom2     IN mdsys.sdo_geometry,
                                          p_precision IN NUMBER,
                                          p_srid      IN NUMBER )
     RETURN NUMBER deterministic;
   /**
   * ST_AreaSimilarityMeasure
   * Measures the degree of similarity between two {@link Geometry}s
   * using the area of intersection between the geometries.
   * The measure is normalized to lie in the range [0, 1].
   * Higher measures indicate a great degree of similarity.
   * <p>
   * NOTE: Currently experimental and incomplete.
   *
   * @param p_geom1     : sdo_geometry : first geometry subject to comparison
   * @param p_geom2     : sdo_geometry : second geometry subject to comparison
   * @param p_precision : int : number of decimal places of precision
   * @return     double : Result of comparison
   * @history    : Simon Greener, August 2011, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   **/
   FUNCTION ST_AreaSimilarityMeasure(p_poly1     IN mdsys.sdo_geometry,
                                     p_poly2     IN mdsys.sdo_geometry,
                                     p_precision IN NUMBER)
     RETURN NUMBER deterministic;
   /**
   * ST_AreaSimilarityMeasure
   * Wrapper. Computations occur in projected space described by p_srid parameter.
   *
   * @param p_geom1     : sdo_geometry : first geometry subject to comparison
   * @param p_geom2     : sdo_geometry : second geometry subject to comparison
   * @param p_precision : int : number of decimal places of precision
   * @param p_srid      : int : SRID of projected space in which actual overlay occurs before
   *                            being projected back to p_geom1.sdo_srid.
   * @return     double : Result of comparison
   * @history    : Simon Greener, August 2011, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   **/
   FUNCTION ST_AreaSimilarityMeasure(p_poly1     IN mdsys.sdo_geometry,
                                     p_poly2     IN mdsys.sdo_geometry,
                                     p_precision IN NUMBER,
                                     p_srid      IN NUMBER )
     RETURN NUMBER deterministic;
   /**
     * ST_Relate
     * Implements a license free version of sdo_geom.RELATE.
     * @note Supports JTS named topological relationships and not Oracle specific keywords like OVERLAPBDYDISJOINT
     * @param p_geom1     : sdo_geometry : geometry which will be compared to second
     * @param p_mask      : varchar2     : Mask containing DETERMINE, ANYINTERACT or a list of comma separated topological relationships
     * @param p_geom2     : sdo_geometry : geometry which will be compared to first.
     * @param p_precision : number of decimal places of precision of a geometry
     * @return String     : Result of processing
     * @throws SQLException
     * @history    : Simon Greener, November 2011, Original Coding; March 2012 Improved return values.
     * @copyright  : Simon Greener, 2011-2013
     * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
     *               http://creativecommons.org/licenses/by-sa/2.5/au/
     */
   FUNCTION ST_Relate(p_geom1     IN mdsys.sdo_geometry,
                      p_mask      IN varchar2,
                      p_geom2     IN mdsys.sdo_geometry,
                      p_precision IN NUMBER)
     RETURN varchar2 Deterministic;
   /**  ======================== PROCESSING ================== **/
   /**
   * ST_MinimumBoundingCircle
   * Computes the Minimum Bounding Circle (MBC) for the points in a Geometry.
   * The MBC is the smallest circle which contains all the input points (this
   * is sometimes known as the Smallest Enclosing Circle). This is equivalent
   * to computing the Maximum Diameter of the input point set.
   * @param p_geom      : sdo_geometry : first geometry subject to MBC calculation
   * @param p_precision : int : number of decimal places of precision
   * @return  circle    : sdo_geometry : Result of MBC calculation
   * @author Martin Davis, JTS 1.12
   * @history    : Simon Greener, August 2011, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   **/
   FUNCTION ST_MinimumBoundingCircle(p_geom      IN mdsys.sdo_geometry,
                                     p_precision IN NUMBER)
     RETURN mdsys.sdo_geometry deterministic;
   /**
   * ST_MinimumBoundingCircle
   * Computes the Minimum Bounding Circle (MBC) for the points in a Geometry.
   * The MBC is the smallest circle which contains all the input points (this
   * is sometimes known as the Smallest Enclosing Circle). This is equivalent
   * to computing the Maximum Diameter of the input point set.
   * @param p_geom      : sdo_geometry : first geometry subject to MBC calculation
   * @param p_precision : int : number of decimal places of precision
   * @param p_srid      : int : SRID of projected space in which actual overlay occurs before
   *                            being projected back to p_geom1.sdo_srid.
   * @return  circle    : sdo_geometry : Result of MBC calculation
   * @author Martin Davis, JTS 1.12
   * @history    : Simon Greener, August 2011, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   **/
   FUNCTION ST_MinimumBoundingCircle(p_geom      IN mdsys.sdo_geometry,
                                     p_precision IN NUMBER,
                                     p_srid      IN NUMBER )
     RETURN mdsys.sdo_geometry deterministic;
   /**
   * ST_Buffer
   * Buffer a geodetic geometry using variety of parameters including single siding.
   * Allows for executing using normal defaults.
   *
   * @param p_geom             : sdo_geometry : first geometry subject to overlay action
   * @param p_distance         : number : buffer distance
   * @param p_precision        : int : number of decimal places of precision
   * @param p_endCapStyle      : int : One of BufferParameters.CAP_ROUND,BufferParameters.CAP_BUTT, BufferParameters.CAP_SQUARE
   * @param p_joinStyle        : int : One of BufferParameters.JOIN_ROUND, BufferParameters.JOIN_MITRE, or BufferParameters.JOIN_BEVEL
   * @param p_quadrantSegments : int : Stroking of curves
   * @param p_singleSided      : int : If 1(true), p_distance > 0 means LEFT sided buffer else right sided
   * @param p_srid             : int : SRID of projected space in which actual overlay occurs before
   *                                   being projected back to p_geom1.sdo_srid.
   * @return SDO_GEOMETRY      : Result of buffer
   * @history    : Simon Greener, August 2011, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   */
   FUNCTION ST_Buffer(p_geom             IN mdsys.sdo_geometry,
                      p_distance         IN NUMBER,
                      p_precision        IN NUMBER,
                      p_endCapStyle      IN NUMBER  DEFAULT &&defaultSchema..SC4O.CAP_ROUND,
                      p_joinStyle        IN NUMBER  DEFAULT &&defaultSchema..SC4O.JOIN_ROUND,
                      p_quadrantSegments IN NUMBER  DEFAULT &&defaultSchema..SC4O.QUADRANT_SEGMENTS,
                      p_singleSided      IN BOOLEAN DEFAULT FALSE,
                      p_srid             IN NUMBER  DEFAULT NULL)
     RETURN mdsys.sdo_geometry
            Deterministic;
   /**
   * ST_Buffer
   * Actual wrapper Function ST_over Java class for which all parameters must be supplied.
   *
   * @param p_geom             : sdo_geometry : first geometry subject to overlay action
   * @param p_distance         : number : buffer distance
   * @param p_precision        : int : number of decimal places of precision
   * @param p_endCapStyle      : int : One of BufferParameters.CAP_ROUND,BufferParameters.CAP_BUTT, BufferParameters.CAP_SQUARE
   * @param p_joinStyle        : int : One of BufferParameters.JOIN_ROUND, BufferParameters.JOIN_MITRE, or BufferParameters.JOIN_BEVEL
   * @param p_quadrantSegments : int : Stroking of curves
   * @param p_singleSided      : int : If 1(true), p_distance > 0 means LEFT sided buffer else right sided
   * @return SDO_GEOMETRY      : Result of buffer
   * @history    : Simon Greener, August 2011, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   */
   FUNCTION ST_Buffer(p_geom             IN mdsys.sdo_geometry,
                      p_distance         IN NUMBER,
                      p_precision        IN NUMBER,
                      p_endCapStyle      IN NUMBER,
                      p_joinStyle        IN NUMBER,
                      p_quadrantSegments IN NUMBER,
                      p_singleSided      IN NUMBER )
     RETURN mdsys.sdo_geometry
            Deterministic;
   /**
   * ST_Centroid
   *
   * @param p_geom        : sdo_geometry : geometry for which a centroid is to be calculated by JTS
   * @param p_precision   : int : number of decimal places of precision when comparing ordinates.
   * @param _interior     : int : if +ve computes an interior point of this Geometry.
   *                              An interior point is guaranteed to lie in the interior
   *                              of the Geometry, if it possible to calculate such a
   *                              point exactly. Otherwise, the point may lie on the
   *                              boundary of the geometry.
   * @return sdo_geometry : centroid as calculated by JTS
   * @history    : Simon Greener, November 2011, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   **/
   FUNCTION ST_Centroid(p_geom      IN mdsys.sdo_geometry,
                        p_precision IN NUMBER,
                        p_interior  IN NUMBER DEFAULT 1)
     RETURN mdsys.sdo_geometry
            deterministic;
   /**
   * ST_ConvexHull
   *
   * @param p_geom        : sdo_geometry : geometry for which a ConvexHull is to be calculated by JTS
   * @param p_precision   : int : number of decimal places of precision when comparing ordinates.
   * @return sdo_geometry : centroid as calculated by JTS
   * @history    : Simon Greener, November 2011, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   **/
   FUNCTION ST_ConvexHull(p_geom      IN mdsys.sdo_geometry,
                          p_precision IN NUMBER)
     RETURN mdsys.sdo_geometry
            deterministic;
   /** ============================ EDIT ==================================== **/
   /**
   * ST_Densify
   * Densifies a geometry using a given distance tolerance,
   * and respecting the input geometry's PrecisionModel
   * @param p_geom      : sdo_geometry : first geometry subject to MBC calculation
   * @param p_precision : int : number of decimal places of precision
   * @param p_distanceTolerance : the distance tolerance to densify
   * @return SDO_GEOMETRY : The densified geometry
   * @author Martin Davis, JTS 1.12
   * @history    : Simon Greener, August 2011, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   **/
   FUNCTION ST_Densify(p_geom              IN mdsys.sdo_geometry,
                       p_precision         IN NUMBER,
                       p_distanceTolerance IN NUMBER)
     RETURN mdsys.sdo_geometry deterministic;
   /**
   * ST_Densify
   * Densifies a geometry using a given distance tolerance,
   * and respecting the input geometry's PrecisionModel
   * Computations occur in projected space described by p_srid parameter.
   * @param p_geom              : sdo_geometry : first geometry subject to MBC calculation
   * @param p_precision         : int          : number of decimal places of precision
   * @param p_distanceTolerance : double       : the distance tolerance to densify
   * @param p_srid              : int          : SRID of projected space in which actual overlay occurs before
   *                                             being projected back to p_geom1.sdo_srid.
   * @return SDO_GEOMETRY : The densified geometry
   * @author Martin Davis, JTS 1.12
   * @history    : Simon Greener, August 2011, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   **/
   FUNCTION ST_Densify(p_geom              IN mdsys.sdo_geometry,
                       p_precision         IN NUMBER,
                       p_distanceTolerance IN NUMBER,
                       p_srid              IN NUMBER)
     RETURN mdsys.sdo_geometry
            deterministic;
   /**
    * ST_LineMerger
    * Takes set of linestring geometries and constructs a collection of linear components
    * that form maximal-length linestrings. The linear components are returned as a MultiLineString.
    * @param p_resultSet  : RefCur_T : Ref Cursor of Linestring Geometries
    * @param p_precision  : int   : Number of decimal places of precision when comparing ordinates.
    * @return STRUCT      : Collection of linear sdo_geometries as MultiLineString.
    * @throws SQLException
    * @history    : Simon Greener, January 2012, Original Coding
    * @copyright  : Simon Greener, 2011-2013
    * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
    *               http://creativecommons.org/licenses/by-sa/2.5/au/
    **/
   FUNCTION ST_LineMerger(p_resultSet IN &&defaultSchema..SC4O.refcur_t,
                          p_precision IN NUMBER)
     RETURN mdsys.sdo_geometry
            Deterministic;
   /**
    * ST_LineMerger
    * Takes set of linestring geometries and constructs a collection of linear components
    * that form maximal-length linestrings. The linear components are returned as a MultiLineString.
   * @param p_geomset     : sdo_geometry_array : Table of Linestring Geometries
    * @param p_precision  : int           : Number of decimal places of precision when comparing ordinates.
    * @return STRUCT      : Collection of linear sdo_geometries as MultiLineString.
    * @throws SQLException
    * @history    : Simon Greener, January 2012, Original Coding
    * @copyright  : Simon Greener, 2011-2013
    * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
    *               http://creativecommons.org/licenses/by-sa/2.5/au/
    **/
   FUNCTION ST_LineMerger(p_geomset   IN mdsys.sdo_geometry_array,
                          p_precision IN NUMBER)
     RETURN mdsys.sdo_geometry
            Deterministic;
   /**
    * ST_NodeLinestrings
    * Takes a GeometryCollection of linestring geometries and ensures nodes
    * are created at all topological intersections
    * common vertex is inserted into each linestring).
    * @param p_geometry  : sdo_geometry : Collection of linestrings
    * @param p_precision : int          : Number of decimal places of precision when comparing ordinates.
    * @return STRUCT     : Collection of linear sdo_geometries as MultiLineString.
    * @throws SQLException
    * @history    : Simon Greener, February 2013, Original Coding
    * @copyright  : Simon Greener, 2011-2013
    * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
    *               http://creativecommons.org/licenses/by-sa/2.5/au/
    **/
   FUNCTION ST_NodeLinestrings(p_geometry  IN mdsys.sdo_geometry,
                               p_precision IN NUMBER)
     RETURN mdsys.sdo_geometry
            Deterministic;
   /**
    * ST_NodeLinestrings
    * Takes ref cursor containing linestring geometries and ensures nodes
    * are created at all topological intersections
    * @param p_resultSet  : RefCur_T : Ref Cursor of Linestring Geometries
    * @param p_precision  : int   : Number of decimal places of precision when comparing ordinates.
    * @return STRUCT      : Collection of linear sdo_geometries as MultiLineString.
    * @throws SQLException
    * @history    : Simon Greener, February 2013, Original Coding
    * @copyright  : Simon Greener, 2011-2013
    * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
    *               http://creativecommons.org/licenses/by-sa/2.5/au/
    **/
   FUNCTION ST_NodeLinestrings(p_resultSet IN &&defaultSchema..SC4O.refcur_t,
                               p_precision IN NUMBER)
     RETURN mdsys.sdo_geometry
            Deterministic;
   /**
    * ST_NodeLinestrings
    * Takes an array containing linestring geometries and ensures nodes
    * are created at all topological intersections
    * @param p_geomset   : sdo_geometry_array : Table of Linestring Geometries
    * @param p_precision : int                : Number of decimal places of precision when comparing ordinates.
    * @return STRUCT     : Collection of linear sdo_geometries as MultiLineString.
    * @throws SQLException
    * @history    : Simon Greener, February 2013, Original Coding
    * @copyright  : Simon Greener, 2011-2013
    * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
    *               http://creativecommons.org/licenses/by-sa/2.5/au/
    */
   FUNCTION ST_NodeLinestrings(p_geomset   IN mdsys.sdo_geometry_array,
                               p_precision IN NUMBER)
     RETURN mdsys.sdo_geometry
            Deterministic;
   /**
    * ST_PolygonBuilder
    * Method for building a polygon from a set of linestrings
    *
    * @param p_resultSet   : Ref Cursor   : Collection of sdo_geometry (linestrings from which polygons will be built)
    * @param p_precision   : int : number of decimal places of precision when comparing ordinates.
    * @return SDO_GEOMETRY : Polygon, MultiPolygon or NULL geometry depending on success of processing.
    * @history    : Simon Greener, August 2011, Original Coding
    * @copyright  : Simon Greener, 2011-2013
    * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
    *               http://creativecommons.org/licenses/by-sa/2.5/au/
   **/
   FUNCTION ST_PolygonBuilder(p_resultSet IN &&defaultSchema..SC4O.refcur_t,
                              p_precision IN NUMBER)
     RETURN mdsys.sdo_geometry
            Deterministic;
   /**
    * ST_PolygonBuilder
    * Method for building a polygon from a set of linestrings
    *
    * @param p_geomset     : sdo_geometry_array : Array of Linestring Geometries
    * @param p_precision   : int : number of decimal places of precision when comparing ordinates.
    * @return SDO_GEOMETRY : Polygon, MultiPolygon or NULL geometry depending on success of processing.
    * @history    : Simon Greener, February 2012, Original Coding
    * @copyright  : Simon Greener, 2011-2013
    * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
    *               http://creativecommons.org/licenses/by-sa/2.5/au/
   **/
   FUNCTION ST_PolygonBuilder(p_geomset   IN mdsys.sdo_geometry_array,
                              p_precision IN NUMBER)
     RETURN mdsys.sdo_geometry
            Deterministic;
   /**
    * ST_PolygonBuilder
    * Method for building a polygon from a set of linestrings
    *
    * @param p_geometry    : mdsys.sdo_geometry : Single geometry containing Linestring(s)
    * @param p_precision   : int : number of decimal places of precision when comparing ordinates.
    * @return SDO_GEOMETRY : Polygon, MultiPolygon or NULL geometry depending on success of processing.
    * @history    : Simon Greener, February 2012, Original Coding
    * @copyright  : Simon Greener, 2011-2013
    * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
    *               http://creativecommons.org/licenses/by-sa/2.5/au/
   **/
   FUNCTION ST_PolygonBuilder(p_geometry  IN mdsys.sdo_geometry,
                              p_precision IN NUMBER)
     RETURN mdsys.sdo_geometry
            Deterministic;
   /**
    * ST_DelaunayTriangles
    * Method for creating a delaunay triangulation from a geometry input (eg multipoints)
    *
    * @param p_geometry    : mdsys.sdo_geometry : Single sdo_geometry object from whose vertices the delaunay triangles will be build.
    * @param p_tolerance   : number             : Snapping tolerance which will be used to improved the robustness of the triangulation computation.
    * @param p_precision   : Number             : number of decimal places of precision when comparing ordinates.
    * @return SDO_GEOMETRY : Collection of Polygon geometries.
    * @history    : Simon Greener, February 2012, Original Coding
    * @copyright  : Simon Greener, 2011-2013
    * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
    *               http://creativecommons.org/licenses/by-sa/2.5/au/
    **/
    FUNCTION ST_DelaunayTriangles(p_geometry  IN mdsys.sdo_geometry,
                                 p_tolerance IN NUMBER,
                                 p_precision IN NUMBER)
     RETURN mdsys.sdo_geometry
            Deterministic;
  /**
    * ST_DelaunayTriangles
    * Method for creating a delaunay triangulation from a geometry input (eg mu ltipoints)
    *
    * @param p_resultSet   : Ref Cursor : Selection of sdo_geometry objects from whose vertices the Delaunay Triangles will be built
    * @param p_tolerance   : number     : Snapping tolerance which will be used to improved the robustness of the triangulation computation.
    * @param p_precision   : Number     : number of decimal places of precision when comparing ordinates.
    * @return SDO_GEOMETRY : Collection of Polygon geometries.
    * @history    : Simon Greener, February 2012, Original Coding
    * @copyright  : Simon Greener, 2011-2013
    * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
    *               http://creativecommons.org/licenses/by-sa/2.5/au/
   **/
   FUNCTION ST_DelaunayTriangles(p_resultSet IN &&defaultSchema..SC4O.refcur_t,
                                 p_tolerance IN NUMBER,
                                 p_precision IN NUMBER)
     RETURN mdsys.sdo_geometry
            Deterministic;
  /**
    * ST_DelaunayTriangles
    * Method for creating a delaunay triangulation from a geometry input (eg multipoints)
    *
    * @param p_geomset     : sdo_geometry_array : Array of sdo_geometry objects from whose vertices the delaunay triangles will be build.
    * @param p_tolerance   : number             : Snapping tolerance which will be used to improved the robustness of the triangulation computation.
    * @param p_precision   : Number             : number of decimal places of precision when comparing ordinates.
    * @return SDO_GEOMETRY : Collection of Polygon geometries.
    * @history    : Simon Greener, February 2012, Original Coding
    * @copyright  : Simon Greener, 2011-2013
    * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
    *               http://creativecommons.org/licenses/by-sa/2.5/au/
   **/
   FUNCTION ST_DelaunayTriangles(p_geomset   IN mdsys.sdo_geometry_array,
                                 p_tolerance IN NUMBER,
                                 p_precision IN NUMBER)
     RETURN mdsys.sdo_geometry
            Deterministic;
   /**
    * ST_Voronoi
    * Method for creating a Voronoi diagram from a geometry input (eg multipoints)
    *
    * @param p_geometry    : sdo_geometry : Single geometry containing source points from whom the voronoi will be built.
    * @param p_envelope    : sdo_geometry : Single geometry containing limiting envelope for triangulation
    * @param p_tolerance   : number       : Snapping tolerance (coordinate sysstem units only) which will be used
    *                                       to improved the robustness of the computation.
    * @param p_precision   : Number       : number of decimal places of precision when comparing ordinates.
    * @return SDO_GEOMETRY : Collection of Polygon geometries.
    * @history    : Simon Greener, February 2012, Original Coding
    * @copyright  : Simon Greener, 2011-2013
    * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
    *               http://creativecommons.org/licenses/by-sa/2.5/au/
   **/
   FUNCTION ST_Voronoi(p_geometry  IN mdsys.sdo_geometry,
                       p_envelope  IN mdsys.sdo_geometry,
                       p_tolerance IN NUMBER,
                       p_precision IN NUMBER)
     RETURN mdsys.sdo_geometry
            Deterministic;
  /**
    * ST_Voronoi
    * Method for creating a Voronoi diagram from a selection of geometry objects.
    *
    * @param p_resultSet   : Ref Cursor : Selection (cursor) of sdo_geometry objects from whose vertices the voronoi will be built.
    * @param p_envelope    : sdo_geometry : Single geometry containing limiting envelope for triangulation
    * @param p_tolerance   : number     : Snapping tolerance which will be used to improved the robustness of the triangulation computation.
    * @param p_precision   : Number     : number of decimal places of precision when comparing ordinates.
    * @return SDO_GEOMETRY : Collection of Polygon geometries.
    * @history    : Simon Greener, February 2012, Original Coding
    * @copyright  : Simon Greener, 2011-2013
    * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
    *               http://creativecommons.org/licenses/by-sa/2.5/au/
   **/
   FUNCTION ST_Voronoi(p_resultSet IN &&defaultSchema..SC4O.refcur_t,
                       p_envelope  IN mdsys.sdo_geometry,
                       p_tolerance IN NUMBER,
                       p_precision IN NUMBER)
     RETURN mdsys.sdo_geometry
            Deterministic;
  /**
    * ST_Voronoi
    * Method for creating a Voronoi diagram from an array of geometry objects.
    *
    * @param p_geomset     : sdo_geometry_array : Array of sdo_geometry objects from whose points the voronoi will be built.
    * @param p_envelope    : sdo_geometry : Single geometry containing limiting envelope for triangulation
    * @param p_tolerance   : number             : Snapping tolerance which will be used to improved the robustness of the triangulation computation.
    * @param p_precision   : Number             : number of decimal places of precision when comparing ordinates.
    * @return SDO_GEOMETRY : Collection of Polygon geometries.
    * @history    : Simon Greener, February 2012, Original Coding
    * @copyright  : Simon Greener, 2011-2013
    * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
    *               http://creativecommons.org/licenses/by-sa/2.5/au/
   **/
   FUNCTION ST_Voronoi(p_geomset   IN mdsys.sdo_geometry_array,
                       p_envelope  IN mdsys.sdo_geometry,
                       p_tolerance IN NUMBER,
                       p_precision IN NUMBER)
     RETURN mdsys.sdo_geometry
            Deterministic;
    /**
     * ST_InterpolateZ
     * @param p_point : mdsys.sdo_geometry : Point for which Z ordinate's value is to be computed
     * @param p_geom1 : mdsys.sdo_geometry : First corner geometry 3D point
     * @param p_geom2 : mdsys.sdo_geometry : Second corner geometry 3D point
     * @param p_geom3 : mdsys.sdo_geometry : Third corner geometry 3D point
     * @return Number : Result of Interpolation
     * @throws SQLException
     * @history    : Simon Greener, March 2012, Original Coding
     * @copyright  : Simon Greener, 2011-2013
     * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
     *               http://creativecommons.org/licenses/by-sa/2.5/au/
    **/
    FUNCTION ST_InterpolateZ(p_point IN mdsys.sdo_geometry,
                             p_geom1 IN mdsys.sdo_geometry,
                             p_geom2 IN mdsys.sdo_geometry,
                             p_geom3 IN mdsys.sdo_geometry)
     RETURN NUMBER Deterministic;
    /**
      * ST_InterpolateZ
      * @param _point         : STRUCT : Point for which Z ordinate's value is to be computed
      * @param _facet         : STRUCT : 3 vertex triangular polygon
      * @return double        : Result of Interpolation
      * @throws SQLException
      * @history    : Simon Greener, March 2012, Original Coding
      * @copyright  : Simon Greener, 2011-2013
      * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
      *               http://creativecommons.org/licenses/by-sa/2.5/au/
     **/
    FUNCTION ST_InterpolateZ(p_point IN mdsys.sdo_geometry,
                             p_facet IN mdsys.sdo_geometry)
     RETURN mdsys.sdo_geometry Deterministic;
   /**
     * ST_Snap
     * Snaps both geometries to each other with both being able to move.
     * Returns compound sdo_geometry ie x004
     *
     * @param p_geom1         : sdo_geometry : first snapping geometry
     * @param p_geom2         : sdo_geometry : second snapping geometry
     * @param p_snapTolerance : double : Distance tolerance is used to control where snapping is performed.
     * @param p_precision     : number of decimal places of precision of a geometry
     * @return SDO_GEOMETRY   : Result of snap which is always a compound geometry x004
     * @throws SQLException
     * @history    : Simon Greener, September 2011, Original Coding
     * @copyright  : Simon Greener, 2011-2013
     * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
     *               http://creativecommons.org/licenses/by-sa/2.5/au/
    **/
    FUNCTION ST_Snap(p_geom1         IN mdsys.sdo_geometry,
                     p_geom2         IN mdsys.sdo_geometry,
                     p_snapTolerance IN NUMBER,
                     p_precision     IN NUMBER)
      RETURN mdsys.sdo_geometry deterministic;
   /**
    * ST_Snap
    * Snaps both geometries to each other with both being able to move.
    * Returns compound sdo_geometry ie x004
    * Computations occur in projected space described by p_srid parameter.
    *
    * @param p_geom1         : sdo_geometry : first snapping geometry
    * @param p_geom2         : sdo_geometry : second snapping geometry
    * @param p_snapTolerance : double : Distance tolerance is used to control where snapping is performed.
    * @param p_precision     : number of decimal places of precision of a geometry
    * @param p_srid          : int : SRID of projected space in which actual overlay occurs before
    *                                being projected back to p_geom1.sdo_srid.
    * @return SDO_GEOMETRY  : Result of snap. Is always a compound geometry x004
    * @throws SQLException
    * @history    : Simon Greener, September 2011, Original Coding
    * @copyright  : Simon Greener, 2011-2013
    * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
    *               http://creativecommons.org/licenses/by-sa/2.5/au/
    **/
    FUNCTION ST_Snap(p_geom1         IN mdsys.sdo_geometry,
                     p_geom2         IN mdsys.sdo_geometry,
                     p_snapTolerance IN NUMBER,
                     p_precision     IN NUMBER,
                     p_srid          IN NUMBER)
      RETURN mdsys.sdo_geometry deterministic;
   /**
    * ST_SnapTo
    * Snaps the vertices in the component LineStrings of the source geometry to the vertices of the given snap geometry.
    *
    * @param p_geom1         : sdo_geometry : geometry which will be snapped to the second geometry
    * @param p_snapGeom      : sdo_geometry : the snapTo geometry
    * @param p_snapTolerance : double : Distance tolerance is used to control where snapping is performed.
    * @param p_precision     : number of decimal places of precision of a geometry
    * @return SDO_GEOMETRY  : Result of snapTo
    * @throws SQLException
    * @history    : Simon Greener, September 2011, Original Coding
    * @copyright  : Simon Greener, 2011-2013
    * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
    *               http://creativecommons.org/licenses/by-sa/2.5/au/
   **/
   FUNCTION ST_SnapTo(p_geom1         IN mdsys.sdo_geometry,
                      p_snapGeom      IN mdsys.sdo_geometry,
                      p_snapTolerance IN NUMBER,
                      p_precision     IN NUMBER)
     RETURN mdsys.sdo_geometry deterministic;
   /**
    * ST_SnapTo
    * Snaps the vertices in the component LineStrings of the source geometry to the vertices of the given snap geometry.
    * Computations occur in projected space described by p_srid parameter.
    *
    * @param p_geom1         : sdo_geometry : geometry which will be snapped to the second geometry
    * @param p_snapGeom      : sdo_geometry : the snapTo geometry
    * @param p_snapTolerance : double : Distance tolerance is used to control where snapping is performed.
    * @param p_precision     : number of decimal places of precision of a geometry
    * @param p_srid          : int : SRID of projected space in which actual overlay occurs before
    *                                being projected back to p_geom1.sdo_srid.
    * @return SDO_GEOMETRY  : Result of snapTo
    * @throws SQLException
    * @history    : Simon Greener, September 2011, Original Coding
    * @copyright  : Simon Greener, 2011-2013
    * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
    *               http://creativecommons.org/licenses/by-sa/2.5/au/
   **/
   FUNCTION ST_SnapTo(p_geom1         IN mdsys.sdo_geometry,
                      p_snapGeom      IN mdsys.sdo_geometry,
                      p_snapTolerance IN NUMBER,
                      p_precision     IN NUMBER,
                      p_srid          IN NUMBER)
     RETURN mdsys.sdo_geometry deterministic;
   /**
    * ST_SnapToSelf
    * Snaps the vertices in the component LineStrings of the source geometry to itself.
    *
    * @param p_geom          : sdo_geometry : geometry which will be snapped to itself
    * @param p_snapTolerance : double : Distance tolerance is used to control where snapping is performed.
    * @param p_precision     : number of decimal places of precision of a geometry
    * @param p_srid          : int : SRID of projected space in which actual overlay occurs before
    *                                being projected back to p_geom1.sdo_srid.
    * @return SDO_GEOMETRY   : Result of snapToSelf
    * @throws SQLException
    * @history    : Simon Greener, September 2011, Original Coding
    * @copyright  : Simon Greener, 2011-2013
    * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
    *               http://creativecommons.org/licenses/by-sa/2.5/au/
   **/
   FUNCTION ST_SnapToSelf(p_geom          IN mdsys.sdo_geometry,
                          p_snapTolerance IN NUMBER,
                          p_precision     IN NUMBER)
     RETURN mdsys.sdo_geometry deterministic;
   /**
    * ST_SnapToSelf
    * Snaps the vertices in the component LineStrings of the source geometry to itself.
    * Computations occur in projected space described by p_srid parameter.
    *
    * @param p_geom          : sdo_geometry : geometry which will be snapped to itself
    * @param p_snapTolerance : double : Distance tolerance is used to control where snapping is performed.
    * @param p_precision     : number of decimal places of precision of a geometry
    * @param p_srid          : int : SRID of projected space in which actual overlay occurs before
    *                                being projected back to p_geom1.sdo_srid.
    * @return SDO_GEOMETRY   : Result of snapToSelf
    * @throws SQLException
    * @history    : Simon Greener, September 2011, Original Coding
    * @copyright  : Simon Greener, 2011-2013
    * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
    *               http://creativecommons.org/licenses/by-sa/2.5/au/
   **/
   FUNCTION ST_SnapToSelf(p_geom          IN mdsys.sdo_geometry,
                          p_snapTolerance IN NUMBER,
                          p_precision     IN NUMBER,
                          p_srid          IN NUMBER)
     RETURN mdsys.sdo_geometry deterministic;
   /**
    * ST_CoordinateRounder
    * Method for rounding the coordinates of a geometry to a particular precision
    *
    * @param p_geom        : sdo_geometry : sdo_geometry object
    * @param p_precision   : int          : number of decimal places of precision when rounding ordinates
    * @return SDO_GEOMETRY : MBR as Polygon
    * @history    : Simon Greener, January 2012, Original Coding
    * @copyright  : Simon Greener, 2011-2013
    * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
    *               http://creativecommons.org/licenses/by-sa/2.5/au/
   **/
   FUNCTION ST_CoordinateRounder(p_geom      IN mdsys.sdo_geometry,
                                 p_precision IN NUMBER)
     RETURN mdsys.sdo_geometry
            deterministic;
   /** =========================== Simplification ======================== **/
   /**
    * ST_DouglasPeuckerSimplify
    *
    * @param p_geom              : sdo_geometry : geometry for which a Douglas Peucker based simplification is to be calculated by JTS
    * @param p_distanceTolerance : Number       : The maximum distance difference (similar to the one used in the Douglas-Peucker algorithm)
    * @param p_precision         : int          : number of decimal places of precision when comparing ordinates.
    * @return sdo_geometry       : Simplified geometry as calculated by JTS
    * @Notes: Simplifies a {@link Geometry} using the standard Douglas-Peucker algorithm.
    *         Ensures that any polygonal geometries returned are valid.
    *         In general D-P does not preserve topology e.g. polygons can be split, collapse to lines or disappear
    *         holes can be created or disappear, and lines can cross. However, this implementation attempts always
    *         to preserve topology. Switch to not preserve topology is not exposed to PL/SQL.
    * @history    : Simon Greener, January 2012, Original Coding
    * @copyright  : Simon Greener, 2011-2013
    * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
    *               http://creativecommons.org/licenses/by-sa/2.5/au/
   **/
   FUNCTION ST_DouglasPeuckerSimplify(p_geom              IN mdsys.sdo_geometry,
                                      p_distanceTolerance IN NUMBER,
                                      p_precision         IN NUMBER)
     RETURN mdsys.sdo_geometry
            deterministic;
   /**
   * ST_TopologyPreservingSimplify
   *
   * @param p_geom              : sdo_geometry : geometry for which simplification is to be calculated by JTS
   * @param p_distanceTolerance : Number       : The maximum distance difference (similar to the one used in the Douglas-Peucker algorithm)
   * @param p_precision         : int          : number of decimal places of precision when comparing ordinates.
   * @return sdo_geometry       : Simplified geometry as calculated by JTS
   * @Notes: The simplification uses a maximum distance difference algorithm
   * similar to the one used in the Douglas-Peucker algorithm.
   * In particular, if the input is an polygon geometry
   * - The result has the same number of shells and holes (rings) as the input, in the same order
   * - The result rings touch at no more than the number of touching point in the input
   *   (although they may touch at fewer points).
   * (The key implication of this constraint is that the output will be topologically valid if the input was.)
   * @history    : Simon Greener, January 2012, Original Coding
   * @copyright  : Simon Greener, 2011-2013
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   **/
   FUNCTION ST_TopologyPreservingSimplify(p_geom              IN mdsys.sdo_geometry,
                                          p_distanceTolerance IN NUMBER,
                                          p_precision         IN NUMBER)
     RETURN mdsys.sdo_geometry
            deterministic;
   /** ============================= Input / Output =====================================*/
   -- Input
   /**
   * ST_GeomFromEWKT
   * Create SDO_GEOMETRY object from Extended Well Known Text formatted string.
   *
   * @param p_ewkt        : CLOB : EWKT string
   * @return SDO_GEOMETRY : Result of creation
   * @history    : Simon Greener, January 2012, Original Coding
   * @copyright  : Simon Greener, 2007, 2008, 2009, 2010, 2011, 2012
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   *               This software is based on other open source projects. I am very grateful to:
   *               - Java Topology Suite (JTS). http://sourceforge.net/projects/jts-topo-suite/
   *               - JAva SPAtial for SQL (JASPA) is free software redistributed under terms of the
   *                 GNU General Public License Version 2+. http://forge.osor.eu/projects/jaspa/
   *               - GeoTools. http://www.geotools.org/
   */
   FUNCTION ST_GeomFromEWKT(p_ewkt IN CLOB)
     RETURN mdsys.sdo_geometry Deterministic;
   /**
   * ST_GeomFromEWKT
   * Create SDO_GEOMETRY object from Extended Well Known Text formatted string.
   *
   * @param p_ewkt        : CLOB : EWKT string
   * @param p_srid        : Apply srid to created geometry (-1 == null) if doesn't have one.
   * @return SDO_GEOMETRY : Result of creation
   * @history    : Simon Greener, January 2012, Original Coding
   * @copyright  : Simon Greener, 2007, 2008, 2009, 2010, 2011, 2012
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   *               This software is based on other open source projects. I am very grateful to:
   *               - Java Topology Suite (JTS). http://sourceforge.net/projects/jts-topo-suite/
   *               - JAva SPAtial for SQL (JASPA) is free software redistributed under terms of the
   *                 GNU General Public License Version 2+. http://forge.osor.eu/projects/jaspa/
   *               - GeoTools. http://www.geotools.org/
   */
   FUNCTION ST_GeomFromEWKT(p_ewkt IN CLOB,
                            p_srid IN NUMBER)
     RETURN mdsys.sdo_geometry Deterministic;
   /**
   * ST_GeomFromEWKT
   * Create SDO_GEOMETRY object from Extended Well Known Text formatted string.
   *
   * @param p_ewkt        : varchar2 : EWKT string
   * @return SDO_GEOMETRY : Result of creation (NULL SDO_SRID returned)
   * @history    : Simon Greener, January 2012, Original Coding
   * @copyright  : Simon Greener, 2007, 2008, 2009, 2010, 2011, 2012
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   *               This software is based on other open source projects. I am very grateful to:
   *               - Java Topology Suite (JTS). http://sourceforge.net/projects/jts-topo-suite/
   *               - JAva SPAtial for SQL (JASPA) is free software redistributed under terms of the
   *                 GNU General Public License Version 2+. http://forge.osor.eu/projects/jaspa/
   *               - GeoTools. http://www.geotools.org/
   */
   FUNCTION ST_GeomFromEWKT(p_ewkt IN varchar2)
     RETURN mdsys.sdo_geometry Deterministic;
   /**
   * ST_GeomFromEWKT
   * Create SDO_GEOMETRY object from Extended Well Known Text formatted string.
   *
   * @param p_ewkt        : varchar2 : EWKT string
   * @param p_srid        : Apply srid to created geometry (-1 == null) if doesn't have one.
   * @return SDO_GEOMETRY : Result of creation
   * @history    : Simon Greener, January 2012, Original Coding
   * @copyright  : Simon Greener, 2007, 2008, 2009, 2010, 2011, 2012
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   *               This software is based on other open source projects. I am very grateful to:
   *               - Java Topology Suite (JTS). http://sourceforge.net/projects/jts-topo-suite/
   *               - JAva SPAtial for SQL (JASPA) is free software redistributed under terms of the
   *                 GNU General Public License Version 2+. http://forge.osor.eu/projects/jaspa/
   *               - GeoTools. http://www.geotools.org/
   */
   FUNCTION ST_GeomFromEWKT(p_ewkt IN varchar2,
                            p_srid IN NUMBER)
     RETURN mdsys.sdo_geometry Deterministic;
   /**
   * ST_GeomFromText
   * Create SDO_GEOMETRY object from Well Known Text (WKT) formatted string.
   *
   * @param p_wkt         : CLOB : WKT string (no SRID)
   * @return SDO_GEOMETRY : Result of creation
   * @history    : Simon Greener, January 2012, Original Coding
   * @copyright  : Simon Greener, 2007, 2008, 2009, 2010, 2011, 2012
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   *               This software is based on other open source projects. I am very grateful to:
   *               - Java Topology Suite (JTS). http://sourceforge.net/projects/jts-topo-suite/
   *               - JAva SPAtial for SQL (JASPA) is free software redistributed under terms of the
   *                 GNU General Public License Version 2+. http://forge.osor.eu/projects/jaspa/
   *               - GeoTools. http://www.geotools.org/
   */
   FUNCTION ST_GeomFromText(p_wkt IN CLOB)
     RETURN mdsys.sdo_geometry Deterministic;
   /**
   * ST_GeomFromText
   * Create SDO_GEOMETRY object from Extended Well Known Text formatted string.
   *
   * @param p_wkt         : CLOB : WKT string (no SRID)
   * @param p_srid        : Apply srid to created geometry (-1 == null)
   * @return SDO_GEOMETRY : Result of creation
   * @history    : Simon Greener, January 2012, Original Coding
   * @copyright  : Simon Greener, 2007, 2008, 2009, 2010, 2011, 2012
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   *               This software is based on other open source projects. I am very grateful to:
   *               - Java Topology Suite (JTS). http://sourceforge.net/projects/jts-topo-suite/
   *               - JAva SPAtial for SQL (JASPA) is free software redistributed under terms of the
   *                 GNU General Public License Version 2+. http://forge.osor.eu/projects/jaspa/
   *               - GeoTools. http://www.geotools.org/
   */
   FUNCTION ST_GeomFromText(p_wkt  IN CLOB,
                            p_srid IN NUMBER)
     RETURN mdsys.sdo_geometry Deterministic;
   /**
   * ST_GeomFromText
   * Create SDO_GEOMETRY object from Well Known Text formatted string.
   *
   * @param p_wkt         : varchar2 : WKT string (no SRID)
   * @return SDO_GEOMETRY : Result of creation
   * @history    : Simon Greener, January 2012, Original Coding
   * @copyright  : Simon Greener, 2007, 2008, 2009, 2010, 2011, 2012
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   *               This software is based on other open source projects. I am very grateful to:
   *               - Java Topology Suite (JTS). http://sourceforge.net/projects/jts-topo-suite/
   *               - JAva SPAtial for SQL (JASPA) is free software redistributed under terms of the
   *                 GNU General Public License Version 2+. http://forge.osor.eu/projects/jaspa/
   *               - GeoTools. http://www.geotools.org/
   */
   FUNCTION ST_GeomFromText(p_wkt IN varchar2)
     RETURN mdsys.sdo_geometry Deterministic;
   /**
   * ST_GeomFromText
   * Create SDO_GEOMETRY object from Extended Well Known Text formatted string.
   *
   * @param p_wkt         : varchar2 : WKT string (no SRID)
   * @param p_srid        : Apply srid to created geometry (-1 == null)
   * @return SDO_GEOMETRY : Result of creation
   * @history    : Simon Greener, January 2012, Original Coding
   * @copyright  : Simon Greener, 2007, 2008, 2009, 2010, 2011, 2012
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   *               This software is based on other open source projects. I am very grateful to:
   *               - Java Topology Suite (JTS). http://sourceforge.net/projects/jts-topo-suite/
   *               - JAva SPAtial for SQL (JASPA) is free software redistributed under terms of the
   *                 GNU General Public License Version 2+. http://forge.osor.eu/projects/jaspa/
   *               - GeoTools. http://www.geotools.org/
   */
   FUNCTION ST_GeomFromText(p_wkt IN varchar2,
                            p_srid IN NUMBER)
     RETURN mdsys.sdo_geometry Deterministic;
   /**
   * ST_GeomFromGML
   * Create SDO_GEOMETRY object from Geography Markup Language formatted string.
   *
   * @param p_gml         : varchar2 : GML string
   * @return SDO_GEOMETRY : Result of creation
   * @history    : Simon Greener, August 2012, Original Coding
   * @copyright  : Simon Greener, 2007, 2008, 2009, 2010, 2011, 2012
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   *               This software is based on other open source projects. I am very grateful to:
   *               - Java Topology Suite (JTS). http://sourceforge.net/projects/jts-topo-suite/
   *               - JAva SPAtial for SQL (JASPA) is free software redistributed under terms of the
   *                 GNU General Public License Version 2+. http://forge.osor.eu/projects/jaspa/
   *               - GeoTools. http://www.geotools.org/
   */
   FUNCTION ST_GeomFromGML(p_gml IN varchar2)
     RETURN mdsys.sdo_geometry Deterministic;
   -- Output
   /**
   * ST_AsText
   * Creates Well Known Text (WKT) from SDO_GEOMETRY Object
   *
   * @param p_geom : sdo_geometry : sdo_geometry object
   * @return WKT  : CLOB         : Result of creation
   * @history    : Simon Greener, August 2012, Original Coding
   * @copyright  : Simon Greener, 2007, 2008, 2009, 2010, 2011, 2012
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   *               This software is based on other open source projects. I am very grateful to:
   *               - Java Topology Suite (JTS). http://sourceforge.net/projects/jts-topo-suite/
   *               - JAva SPAtial for SQL (JASPA) is free software redistributed under terms of the
   *                 GNU General Public License Version 2+. http://forge.osor.eu/projects/jaspa/
   *               - GeoTools. http://www.geotools.org/
   */
   FUNCTION ST_AsText(p_geom IN sdo_geometry)
     RETURN CLOB deterministic;
   /**
   * ST_AsEWKT
   * Creates Extended Welll Known Text (EWKT) from SDO_GEOMETRY Object
   *
   * @param p_geom : sdo_geometry : sdo_geometry object
   * @return EWKT  : CLOB         : Result of creation
   * @history    : Simon Greener, August 2012, Original Coding
   * @copyright  : Simon Greener, 2007, 2008, 2009, 2010, 2011, 2012
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   *               This software is based on other open source projects. I am very grateful to:
   *               - Java Topology Suite (JTS). http://sourceforge.net/projects/jts-topo-suite/
   *               - JAva SPAtial for SQL (JASPA) is free software redistributed under terms of the
   *                 GNU General Public License Version 2+. http://forge.osor.eu/projects/jaspa/
   *               - GeoTools. http://www.geotools.org/
   */
   FUNCTION ST_AsEWKT(p_geom IN sdo_geometry)
     RETURN CLOB deterministic;
   /**
   * ST_AsGML
   * Creates GML from SDO_GEOMETRY Object
   *
   * @param p_geom : sdo_geometry : sdo_geometry object
   * @return GML   : CLOB         : Result of creation
   * @history    : Simon Greener, August 2012, Original Coding
   * @copyright  : Simon Greener, 2007, 2008, 2009, 2010, 2011, 2012
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   *               This software is based on other open source projects. I am very grateful to:
   *               - Java Topology Suite (JTS). http://sourceforge.net/projects/jts-topo-suite/
   *               - JAva SPAtial for SQL (JASPA) is free software redistributed under terms of the
   *                 GNU General Public License Version 2+. http://forge.osor.eu/projects/jaspa/
   *               - GeoTools. http://www.geotools.org/
   */
   FUNCTION ST_AsGML(p_geom IN sdo_geometry)
     RETURN CLOB deterministic;
   /** ============================= EDITORS =====================================*/
   /**
   * ST_DeleteVertex
   * Removes point/vertex from input geometry.
   *
   * @param p_geom        : sdo_geometry : Geometry to be modified
   * @param p_pointIndex  : int : vertex to be removed from 1..NumPoints with -1 being alias for last point.
   * @return SDO_GEOMETRY : Result of point removal
   * @history    : Simon Greener, January 2012, Original Coding
   * @copyright  : Simon Greener, 2007, 2008, 2009, 2010, 2011, 2012
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   *               This software is based on other open source projects. I am very grateful to:
   *               - Java Topology Suite (JTS). http://sourceforge.net/projects/jts-topo-suite/
   *               - JAva SPAtial for SQL (JASPA) is free software redistributed under terms of the
   *                 GNU General Public License Version 2+. http://forge.osor.eu/projects/jaspa/
   *               - GeoTools. http://www.geotools.org/
   */
   FUNCTION ST_DeleteVertex(p_geom       IN sdo_geometry,
                            p_pointIndex IN NUMBER)
     RETURN mdsys.sdo_geometry deterministic;
   /**
   * ST_UpdateVertex
   * Changes point/vertex values in input geometry to those of the supplied point geometry
   *
   * @param p_geom        : sdo_geometry : Geometry to be modified
   * @param p_pointIndex  : int          : vertex to be changed to values in supplied point (1..NumPoints with -1 being alias for last point)
   * @param p_point       : sdo_geometry : The point geometry holding the new XYZM values
   * @return SDO_GEOMETRY : Result of point change
   * @history    : Simon Greener, January 2012, Original Coding
   * @copyright  : Simon Greener, 2007, 2008, 2009, 2010, 2011, 2012
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   */
   FUNCTION ST_UpdateVertex(p_geom       IN sdo_geometry,
                            p_pointIndex IN NUMBER,
                            p_point      IN sdo_geometry)
     RETURN mdsys.sdo_geometry deterministic;
   /**
   * ST_InsertVertex
   * Adds supplied point geometry at the end of the input geometry
   *
   * @param p_geom        : sdo_geometry : Geometry to be modified
   * @param p_point       : sdo_geometry : The point geometry holding the new XYZM values
   * @return SDO_GEOMETRY : Result of point addition
   * @history    : Simon Greener, January 2012, Original Coding
   * @copyright  : Simon Greener, 2007, 2008, 2009, 2010, 2011, 2012
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   */
   FUNCTION ST_InsertVertex(p_geom  IN sdo_geometry,
                            p_point IN sdo_geometry)
     RETURN mdsys.sdo_geometry deterministic;
   /**
   * ST_InsertVertex
   * Adds supplied point geometry at the supplied position in the input geometry
   *
   * @param p_geom        : sdo_geometry : Geometry to be modified
   * @param p_pointIndex  : int          : Position in input geometry where new point is to be inserted (1..NumPoints with -1 being "add to end of existing points")
   * @param p_point       : sdo_geometry : The point geometry holding the new XYZM values
   * @return SDO_GEOMETRY : Result of point addition
   * @history    : Simon Greener, January 2012, Original Coding
   * @copyright  : Simon Greener, 2007, 2008, 2009, 2010, 2011, 2012
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   */
   FUNCTION ST_InsertVertex(p_geom       IN sdo_geometry,
                            p_pointIndex IN NUMBER,
                            p_point      IN sdo_geometry)
     RETURN mdsys.sdo_geometry deterministic;
   /**
   * ST_InsertVertex
   * Adds supplied point geometry at the supplied position in the input geometry
   *
   * @param p_geom        : sdo_geometry : Geometry to be modified
   * @param p_point       : sdo_geometry : The point geometry holding the new XYZM values
   * @param p_pointIndex  : int          : Position in input geometry where new point is to be inserted (1..NumPoints with -1 being "add to end of existing points")
   * @return SDO_GEOMETRY : Result of point addition
   * @history    : Simon Greener, January 2012, Original Coding
   * @copyright  : Simon Greener, 2007, 2008, 2009, 2010, 2011, 2012
   * @license    : Creative Commons Attribution-Share Alike 2.5 Australia License.
   *               http://creativecommons.org/licenses/by-sa/2.5/au/
   */
   FUNCTION ST_InsertVertex(p_geom       IN sdo_geometry,
                            p_point      IN sdo_geometry,
                            p_pointIndex IN NUMBER)
     RETURN mdsys.sdo_geometry deterministic;
 END SC4O;
 / 
 SHOW ERRORS

I hope this is of use to someone.