CENTROID For Oracle

My CENTROID PL/SQL package is a hot download from this site. It seems there is a need out there for variations on the generating of centroids.

Recently I ported my centroid algorithms to SQL Server Spatial (Denali). In doing so a few improvements or changes were made. These include the ability to:

  • Provide the centroid polygon algorithm with a seed X ordinate to complement the X ordinate that is the midpoint of the MBR of the polygon or the average X ordinate of all the vertices in the polygon;
  • Select the smallest or largest part of a multipart line or polygon geometry as the target for the centroid.

This article now replaces all other articles on my Oracle SDO_GEOMETRY based centroid algorithms.

From the CENTROID package specification, the following functions are available.

   /* ----------------------------------------------------------------------------------------
   * @function   : centroid_p
   * @precis     : Generates centroid for a point (itself) or multipoint.
   * @version    : 1.3
   * @description: This function creates centroid of multipoint via averaging of ordinates.
   * @param      : p_geometry     : MDSYS.SDO_GEOMETRY : The geometry object.
   * @param      : p_round_x      : Number : Ordinate rounding precision for X ordinates.
   * @param      : p_round_y      : Number : Ordinate rounding precision for Y ordinates.
   * @param      : p_round_z      : Number : Ordinate rounding precision for Z ordinates.
   * @return     : centroid       : MDSYS.SDO_GEOMETRY : The centroid.
   * @requires   : GetVector()
   * @history    : Simon Greener - Jul 2008 - Original coding of centroid_p as internal function
   * @history    : Simon Greener - Jan 2012 - Exposed internal function.
   * @copyright  : Free for public use
   **/
   FUNCTION centroid_p(p_geometry IN mdsys.sdo_geometry,
                       p_round_x  IN NUMBER := 3,
                       p_round_y  IN NUMBER := 3,
                       p_round_z  IN NUMBER := 2)
     RETURN MDSYS.SDO_GEOMETRY DETERMINISTIC;
   /* ----------------------------------------------------------------------------------------
   * @function   : centroid_a
   * @precis     : Generates centroid for a polygon.
   * @version    : 1.3
   * @description: The standard mdsys.sdo_geom.sdO_centroid function does not guarantee
   *               that the centroid it generates falls inside the polygon.
   *               This function ensures that the centroid of any arbitrary polygon falls within the polygon.
   * @param      : p_geometry     : MDSYS.SDO_GEOMETRY : The geometry object.
   * @param      : p_start        : pls_integer : 0 = Use average of all Area's vertices for starting X centroid calculation
   *                                              1 = Use centre X of MBR
   *                                              2 = User supplied starting seed X
   * @param      : p_seed_x       : Number : Starting X ordinate for which a Y that is inside the polygon is returned.
   * @param      : p_round_x      : pls_integer : Ordinate rounding precision for X ordinates.
   * @param      : p_round_y      : pls_integer : Ordinate rounding precision for Y ordinates.
   * @param      : p_loops        : pls_integer : Number of attempts to find centroid based on small changes to seed
   * @return     : centroid       : MDSYS.SDO_GEOMETRY : The centroid.
   * @requires   : GetVector()
   * @history    : Simon Greener - Jul 2008 - Original coding of centroid_a as internal function
   * @history    : Simon Greener - Jan 2012 - Exposed internal function. Added p_seed_x support.
   * @copyright  : Free for public use
   **/
   FUNCTION centroid_a(p_geometry IN mdsys.sdo_geometry,
                       p_start    IN pls_integer DEFAULT 1,
                       p_seed_x   IN NUMBER      DEFAULT NULL,
                       p_round_x  IN pls_integer DEFAULT 3,
                       p_round_y  IN pls_integer DEFAULT NULL,
                       p_loops    IN pls_integer DEFAULT 10)
     RETURN MDSYS.SDO_GEOMETRY DETERMINISTIC;
   /* ----------------------------------------------------------------------------------------
   * @function   : Centroid_l
   * @precis     : Generates centroid for a linestring.
   * @version    : 1.3
   * @description: The standard MDSYS.SDO_GEOM.SDO_CENTROID function does not guarantee
   *               that the centroid it generates falls inside the polygon.
   *               This function ensures that the centroid of any arbitrary polygon falls within the polygon.
   * @param      : p_geometry           : MDSYS.SDO_GEOMETRY : The geometry object.
   * @param      : p_position_as_ratio  : Number : Position along multi-line/line where "centroid" created.
   * @param      : p_round_x            : Number : Ordinate rounding precision for X ordinates.
   * @param      : p_round_y            : Number : Ordinate rounding precision for Y ordinates.
   * @param      : p_round_z            : Number : Ordinate rounding precision for Z ordinates.
   * @return     : centroid             : MDSYS.SDO_GEOMETRY : The centroid.
   * @requires   : GetVector()
   * @history    : Simon Greener - Jul 2008 - Original coding of centroid_l as internal function
   * @history    : Simon Greener - Jan 2012 - Exposed internal function.
   * @copyright  : Free for public use
   **/
   FUNCTION centroid_l(p_geometry          IN mdsys.sdo_geometry,
                       p_position_as_ratio IN NUMBER := 0.5,
                       p_round_x           IN NUMBER := 3,
                       p_round_y           IN NUMBER := 3,
                       p_round_z           IN NUMBER := 2)
     RETURN MDSYS.SDO_GEOMETRY DETERMINISTIC;
   /* ----------------------------------------------------------------------------------------
   * @function   : SDO_Centroid
   * @precis     : Generates centroid for a polygon.
   * @version    : 1.5
   * @description: The standard MDSYS.SDO_GEOM.SDO_CENTROID function does not guarantee
   *               that the centroid it generates falls inside the polygon.   Nor does it
   *               generate a centroid for a multi-part polygon shape.
   *               This function ensures that the centroid of any arbitrary polygon
   *               falls within the polygon. Also provides centroid functions for multipoints and linestrings.
   * @param      : p_geometry     : MDSYS.SDO_GEOMETRY : The geometry object.
   * @param      : p_start        : Number : 0 = Use average of all Area's vertices for starting X centroid calculation
   *                                         1 = Use centre X of MBR
   * @param      : p_largest      : Number : 0 = Use smallest of any multipart geometry.
   *                                         1 = Use largest of any multipart geometry.
   * @param      : p_round_x      : Number : Ordinate rounding precision for X ordinates.
   * @param      : p_round_y      : Number : Ordinate rounding precision for Y ordinates.
   * @param      : p_round_z      : Number : Ordinate rounding precision for Z ordinates.
   * @return     : centroid       : MDSYS.SDO_GEOMETRY : The centroid.
   * @requires   : GetVector()
   * @history    : Simon Greener - Mar 2008 - Total re-write of algorithm following on from cases the original algorithm didn't handle.
   *                                          The new algorithm does everything in a single SQL statement which can be run outside of this function if needed.
   *                                          The algorithm is based on a known method for filling a polygon which counts the type and number of crossings of a
   *                                          "ray" (in this case a vertical line) across a polygon boundary. The new algorithm also has improved handling of
   *                                          multi-part geometries and also generates a starting X ordinate for the vertical "ray" using vertex averaging
   *                                          rather than the mid point of a part's MBR. This is to try and "weight" the centroid more towards where detail exists.
   *               Simon Greener - Jul 2008 - Standalone version with no dependencies other than the need for external object types.
   * @copyright  : Free for public use
   **/
     FUNCTION sdo_Centroid(
     p_geometry     IN MDSYS.SDO_GEOMETRY,
     p_start        IN NUMBER := 1,
     p_largest      IN NUMBER := 1,
     p_round_x      IN NUMBER := 3,
     p_round_y      IN NUMBER := 3,
     p_round_z      IN NUMBER := 2)
     RETURN MDSYS.SDO_GEOMETRY DETERMINISTIC;
   /**
   * Overload of main sdo_centroid function
   * @param      : p_tolerance    : Number : Single tolerance for use with all ordinates.
   *                                         Expressed in dataset units eg decimal degrees if 8311.
   *                                         See Convert_Distance for method of converting distance in meters to dataset units.
   **/
   FUNCTION sdo_centroid (
     p_geometry     IN MDSYS.SDO_Geometry,
     p_start        IN NUMBER := 1,
     p_tolerance    IN NUMBER )
     RETURN MDSYS.SDO_Geometry deterministic;
   /**
   * Overload of main sdo_centroid function
   * @param      : p_dimarray  : Number : Supplies all tolerances when processing vertices.
   *                                      Note that the function requires the sdo_tolerances inside the diminfo to be expressed in dataset
   *                                      units eg decimal degrees if 8311. But for Oracle this is in meters for long/lat and dataset units otherwise.
   *                                      Thus use of this wrapper for geodetic data IS NOT RECOMMENDED.
   *                                      See Convert_Distance for method of converting distance in meters to dataset units.
   **/
   FUNCTION Sdo_Centroid(
     p_geometry     IN MDSYS.SDO_GEOMETRY,
     p_start        IN NUMBER := 1,
     p_dimarray     IN MDSYS.SDO_DIM_ARRAY)
     RETURN MDSYS.SDO_Geometry deterministic;
   /* ----------------------------------------------------------------------------------------
   * @function   : Sdo_Multi_Centroid
   * @precis     : Generates centroids for a all parts of a multi-polygon.
   * @version    : 1.0
   * @description: The standard MDSYS.SDO_GEOM.SDO_GEOMETRY function does not guarantee
   *               that the centroid it generates falls inside the polygon.   Nor does it
   *               generate a centroid for a multi-part polygon shape.
   *               This function generates a point for every part of a 2007 multi-part polygon..
   * @param      : p_geometry : MDSYS.SDO_GEOMETRY : The polygon shape.
   * @param      : p_start    : Number : 0 = Use average of all Area's vertices for starting X centroid calculation
   *                                     1 = Use centre X of MBR
   * @param      : p_round_x  : Number : Ordinate rounding precision for X ordinates.
   * @param      : p_round_y  : Number : Ordinate rounding precision for Y ordinates.
   * @param      : p_round_z  : Number : Ordinate rounding precision for Z ordinates.
   * @return     : centroid   : MDSYS.SDO_GEOMETRY : The centroids of the parts as a multi-part shape.
   * @history    : Simon Greener - Jun 2006 - Original coding.
   * @copyright  : Free for public use
   **/
   FUNCTION SDO_Multi_Centroid(
     p_geometry  IN MDSYS.SDO_Geometry,
     p_start     IN NUMBER := 1,
     p_round_x   IN NUMBER := 3,
     p_round_y   IN NUMBER := 3,
     p_round_z   IN NUMBER := 2)
    RETURN MDSYS.SDO_Geometry deterministic;
   /**
   * Overload of main sdo_multi_centroid function
   * @param      : p_geometry  : MdSys.Sdo_Geometry : The sdo_geometry object.
   * @param      : p_start     : Number : 0 = Use average of all Area's vertices for starting X centroid calculation
   *                                      1 = Use centre X of MBR
   * @param      : p_tolerance : Number : Tolerance used when processing vertices.
   * @return     : centroid    : MDSYS.SDO_GEOMETRY : The centroids of the parts as a multi-part shape.
   * @history    : Simon Greener - Jun 2006 - Original coding.
   * @copyright  : Free for public use
   **/
   FUNCTION sdo_multi_centroid(
     p_geometry  IN MDSYS.SDO_Geometry,
     p_start     IN NUMBER := 1,
     p_tolerance IN NUMBER)
     RETURN MDSYS.SDO_Geometry deterministic;
   /**
   * Overload of main sdo_multi_centroid function
   * @param      : p_geometry  : MdSys.Sdo_Geometry : The sdo_geometry object.
   * @param      : p_start     : Number : 0 = Use average of all Area's vertices for starting X centroid calculation
   *                                      1 = Use centre X of MBR
   * @param      : p_dimarray  : Number : Supplies all tolerances when processing vertices.
   *                                      Note that the function requires the sdo_tolerances inside the diminfo to be expressed in dataset
   *                                      units eg decimal degrees if 8311. But for Oracle this is in meters for long/lat and dataset units otherwise.
   *                                      Thus use of this wrapper for geodetic data IS NOT RECOMMENDED.
   *                                      See Convert_Distance for method of converting distance in meters to dataset units.
   * @return     : centroid    : MDSYS.SDO_GEOMETRY : The centroids of the parts as a multi-part shape.
   * @history    : Simon Greener - Jun 2006 - Original coding.
   * @copyright  : Free for public use
   **/
   FUNCTION sdo_multi_centroid(
     p_geometry  IN MDSYS.SDO_Geometry,
     p_start     IN NUMBER := 1,
     p_dimarray  IN MDSYS.SDO_Dim_Array)
     RETURN MDSYS.SDO_Geometry deterministic;

Now for some testing!

MultiPoint

 WITH multiPoint AS (
   SELECT 'O' AS label,  sdo_geometry('MULTIPOINT((0 0),(100 0),(100 100),(0 100),(150 110),(150 150),(110 150),(110 110))',NULL) AS geom
     FROM dual
 )
 SELECT 'O' AS label, geom FROM multiPoint
 UNION ALL
 SELECT 'M' AS label, centroid.Centroid_P(geom,3,3,3) AS geom FROM multiPoint
 UNION ALL
 SELECT 'S' AS label, sdo_geom.sdo_centroid(geom,0.005) AS geom FROM multiPoint;
 -- Results
 LABEL GEOM
 ----- -----------------------------------------------------------------------------------------------------------------------------------------------------
 O     MDSYS.SDO_GEOMETRY(2005,NULL,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1,8),MDSYS.SDO_ORDINATE_ARRAY(0,0,100,0,100,100,0,100,150,110,150,150,110,150,110,110))
 M     MDSYS.SDO_GEOMETRY(2005,NULL,MDSYS.SDO_POINT_TYPE(90,90,NULL),NULL,NULL)
 S     MDSYS.SDO_GEOMETRY(2001,NULL,MDSYS.SDO_POINT_TYPE(90,90,NULL),NULL,NULL)

Centroid_L

 WITH testLine AS (
    SELECT sdo_geometry('LINESTRING(258.72254365233152 770.97400259630615, 268.79365642517564 739.08214548229967, 278.86476919801976 707.1902883682933, 332.57737065318844 693.76213800450114, 366.14774656266889 676.97695004976094, 426.57442319973364 697.11917559544918, 520.57147574627891 737.40362668682576, 631.35371624756431 744.11770186872184, 829.41893411349884 797.83030332389046, 1547.8249785763801 791.11622814199438, 1205.4071442996797 895.18439346138371, 832.77597170444687 1039.5370098721496, 490.3581374277465 1086.5355361454222, 416.50331042688953 1076.464423372578, 381.25441572193506 1059.6792354178378, 346.00552101698065 1042.8940474630976, 320.82773908487036 1019.3947843264614, 295.64995715276001 995.89552118982499, 287.25736317538986 964.00366407581862, 278.86476919801976 932.11180696181225, 282.2218067889678 891.82735587043567, 277.18625040254574 858.25697996095528, 272.15069401612368 824.68660405147489, 258.72254365233152 770.97400259630615)',NULL) AS geom
      FROM dual
 )
 SELECT 'O' AS label, geom FROM testLine
 UNION ALL
 SELECT a.Column_Value*10 || '%' AS label, CENTROID.Centroid_L(geom,a.Column_Value/10.0,3,3,2) AS geom
   FROM testLine,
        TABLE(centroid.generate_series(0,9,1)) a;
 -- Results
 --
 LABEL GEOM
 ----- ----------------------------------------------------------------------------------
 NULL  MDSYS.SDO_GEOMETRY(2002,NULL,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1),MDSYS.SDO_ORDINATE_ARRAY(258.722543652332,770.974002596306,268.793656425176,739.0821454823,278.86476919802,707.190288368293,332.577370653188,693.762138004501,366.147746562669,676.976950049761,426.574423199734,697.119175595449,520.571475746279,737.403626686826,631.353716247564,744.117701868722,829.418934113499,797.83030332389,1547.82497857638,791.116228141994,1205.40714429968,895.184393461384,832.775971704447,1039.53700987215,490.358137427746,1086.53553614542,416.50331042689,1076.46442337258,381.254415721935,1059.67923541784,346.005521016981,1042.8940474631,320.82773908487,1019.39478432646,295.64995715276,995.895521189825,287.25736317539,964.003664075818,278.86476919802,932.111806961812,282.221806788968,891.827355870435,277.186250402546,858.256979960955,272.150694016124,824.686604051475,258.722543652332,770.974002596306))
 0%    MDSYS.SDO_GEOMETRY(2001,NULL,MDSYS.SDO_POINT_TYPE(258.723,770.974,NULL),NULL,NULL)
 10%   MDSYS.SDO_GEOMETRY(2001,NULL,MDSYS.SDO_POINT_TYPE(489.061,723.899,NULL),NULL,NULL)
 20%   MDSYS.SDO_GEOMETRY(2001,NULL,MDSYS.SDO_POINT_TYPE(772.455,782.382,NULL),NULL,NULL)
 30%   MDSYS.SDO_GEOMETRY(2001,NULL,MDSYS.SDO_POINT_TYPE(1061.852,795.658,NULL),NULL,NULL)
 40%   MDSYS.SDO_GEOMETRY(2001,NULL,MDSYS.SDO_POINT_TYPE(1353.305,792.934,NULL),NULL,NULL)
 50%   MDSYS.SDO_GEOMETRY(2001,NULL,MDSYS.SDO_POINT_TYPE(1455.077,819.304,NULL),NULL,NULL)
 60%   MDSYS.SDO_GEOMETRY(2001,NULL,MDSYS.SDO_POINT_TYPE(1176.948,906.209,NULL),NULL,NULL)
 70%   MDSYS.SDO_GEOMETRY(2001,NULL,MDSYS.SDO_POINT_TYPE(905.164,1011.495,NULL),NULL,NULL)
 80%   MDSYS.SDO_GEOMETRY(2001,NULL,MDSYS.SDO_POINT_TYPE(620.926,1068.614,NULL),NULL,NULL)
 90%   MDSYS.SDO_GEOMETRY(2001,NULL,MDSYS.SDO_POINT_TYPE(340.85,1038.082,NULL),NULL,NULL)
 --
  11 ROWS selected

Centroid_A

First, my test polygon.

 WITH testPoly AS (
    SELECT sdo_geometry('POLYGON((2300 -700, 2800 -300, 2300 700, 2800 1100, 2300 1100, 1800 1100, 2300 400, 2300 200, 2100 100, 2500 100, 2300 -200, 1800 -300, 2300 -500, 2200 -400, 2400 -400, 2300 -700),
                                (2300 1000, 2400  900, 2200 900, 2300 1000))',NULL) AS geom
      FROM dual
 )
 SELECT 'O' AS Label, geom FROM testPoly
 UNION ALL
 SELECT 'A' AS Label,
        centroid.centroid_a(geom,0,NULL,3,3,3) AS geom  FROM testPoly
 UNION ALL
 SELECT 'M' AS Label,
        centroid.centroid_a(geom,1,NULL,3,3,3) AS geom  FROM testPoly
 UNION ALL
 SELECT 'U' AS Label,
        centroid.centroid_a(geom,2,2050,3,3,3) AS geom  FROM testPoly
 UNION ALL
 SELECT 'S' AS Label,
        sdo_geom.sdo_centroid(geom,0.005) AS geom FROM testPoly;
 -- Results
 --
 LABEL GEOM
 ----- ----------------------------------------------------------------------------------------------------
 O     MDSYS.SDO_GEOMETRY(2003,NULL,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1,33,2003,1),MDSYS.SDO_ORDINATE_ARRAY(2300,-700,2800,-300,2300,700,2800,1100,2300,1100,1800,1100,2300,400,2300,200,2100,100,2500,100,2300,-200,1800,-300,2300,-500,2200,-400,2400,-400,2300,-700,2300,1000,2400,900,2200,900,2300,1000))
 A     MDSYS.SDO_GEOMETRY(2001,NULL,MDSYS.SDO_POINT_TYPE(2300,550,NULL),NULL,NULL)
 M     MDSYS.SDO_GEOMETRY(2001,NULL,MDSYS.SDO_POINT_TYPE(2300,550,NULL),NULL,NULL)
 U     MDSYS.SDO_GEOMETRY(2001,NULL,MDSYS.SDO_POINT_TYPE(2050,925,NULL),NULL,NULL)
 S     MDSYS.SDO_GEOMETRY(2001,NULL,MDSYS.SDO_POINT_TYPE(2346.66666666667,292.307692307692,NULL),NULL,NULL)

Now some examples relating to weighting and using a X ordinate seed.

 WITH testPoly AS (
 SELECT sdo_geometry('POLYGON((258.72254365233152 770.97400259630615, 268.79365642517564 739.08214548229967, 278.86476919801976 707.1902883682933, 332.57737065318844 693.76213800450114, 366.14774656266889 676.97695004976094, 426.57442319973364 697.11917559544918, 520.57147574627891 737.40362668682576, 631.35371624756431 744.11770186872184, 829.41893411349884 797.83030332389046, 1547.8249785763801 791.11622814199438, 1205.4071442996797 895.18439346138371, 832.77597170444687 1039.5370098721496, 490.3581374277465 1086.5355361454222, 416.50331042688953 1076.464423372578, 381.25441572193506 1059.6792354178378, 346.00552101698065 1042.8940474630976, 320.82773908487036 1019.3947843264614, 295.64995715276001 995.89552118982499, 287.25736317538986 964.00366407581862, 278.86476919801976 932.11180696181225, 282.2218067889678 891.82735587043567, 277.18625040254574 858.25697996095528, 272.15069401612368 824.68660405147489, 258.72254365233152 770.97400259630615))',NULL) AS geom FROM dual
 )
 SELECT 'O' AS Label, geom AS geom FROM testPoly
 UNION ALL
 SELECT 'A' AS Label, centroid.centroid_a(geom,0,NULL,2,2,2) AS geom FROM testPoly
 UNION ALL
 SELECT 'M' AS Label, centroid.centroid_a(geom,1,NULL,2,2,2) AS geom FROM testPoly
 UNION ALL
 SELECT 'U' AS Label, centroid.centroid_a(geom,2,259,2,2,2) AS geom FROM testPoly
 UNION ALL
 SELECT 'S' AS Label, sdo_geom.sdo_centroid(geom,0.005) AS geom FROM testPoly;
 -- Results
 --
 LABEL GEOM
 ----- ----------------------------------------------------------------------------------------------------
 O     MDSYS.SDO_GEOMETRY(2003,NULL,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1),MDSYS.SDO_ORDINATE_ARRAY(258.722543652332,770.974002596306,268.793656425176,739.0821454823,278.86476919802,707.190288368293,332.577370653188,693.762138004501,366.147746562669,676.976950049761,426.574423199734,697.119175595449,520.571475746279,737.403626686826,631.353716247564,744.117701868722,829.418934113499,797.83030332389,1547.82497857638,791.116228141994,1205.40714429968,895.184393461384,832.775971704447,1039.53700987215,490.358137427746,1086.53553614542,416.50331042689,1076.46442337258,381.254415721935,1059.67923541784,346.005521016981,1042.8940474631,320.82773908487,1019.39478432646,295.64995715276,995.895521189825,287.25736317539,964.003664075818,278.86476919802,932.111806961812,282.221806788968,891.827355870435,277.186250402546,858.256979960955,272.150694016124,824.686604051475,258.722543652332,770.974002596306))
 A     MDSYS.SDO_GEOMETRY(2001,NULL,MDSYS.SDO_POINT_TYPE(475.25,901.23,NULL),NULL,NULL)
 M     MDSYS.SDO_GEOMETRY(2001,NULL,MDSYS.SDO_POINT_TYPE(903.27,904.685,NULL),NULL,NULL)
 U     MDSYS.SDO_GEOMETRY(2001,NULL,MDSYS.SDO_POINT_TYPE(259,771.085,NULL),NULL,NULL)
 S     MDSYS.SDO_GEOMETRY(2001,NULL,MDSYS.SDO_POINT_TYPE(701.967711917354,888.255501812355,NULL),NULL,NULL)

General Centroid Method

 WITH multiPoly AS (
    SELECT sdo_geometry('MULTIPOLYGON (((0 0, 100 0, 100 100, 0 100, 0 0)), ((110 110, 150 110, 150 150, 110 150, 110 110)))',NULL) AS geom
      FROM dual
 )
 SELECT 'O' AS label, geom FROM multiPoly
 UNION ALL
 SELECT 'PNTS' AS label,
        sdo_geom.sdo_buffer(
               centroid.sdo_Centroid(sdo_geometry('MULTIPOLYGON (((0 0, 100 0, 100 100, 0 100, 0 0)), ((110 110, 150 110, 150 150, 110 150, 110 110)))',NULL) ,
                                 1 /* Weight By MBR not Vertices */,
                                 1 /* Use Largest part in any multipart */,
                                 3,3,3),
               5,0.005) AS geom
   FROM multiPoly;
 -- Results
 --
 LABEL GEOM
 ----- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 O     MDSYS.SDO_GEOMETRY(2007,NULL,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1,11,1003,1),MDSYS.SDO_ORDINATE_ARRAY(0,0,100,0,100,100,0,100,0,0,110,110,150,110,150,150,110,150,110,110))
 PNTS  MDSYS.SDO_GEOMETRY(2003,NULL,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,2),MDSYS.SDO_ORDINATE_ARRAY(50,45,55,50,50,54.9999999999999,45,50,50,45))

Multi-Centroid Generator

 WITH multiPoly AS (
    SELECT sdo_geometry('MULTIPOLYGON (((0 0, 100 0, 100 100, 0 100, 0 0)), ((110 110, 150 110, 150 150, 110 150, 110 110)))',NULL) AS geom FROM dual
 )
 SELECT 'O' AS label, geom FROM multiPoly
 UNION ALL
 SELECT 'PNTS' AS label, sdo_geom.sdo_buffer(CENTROID.SDO_Multi_Centroid(geom,1 /* Weight By MBR not Vertices */,3,3,3),5,0.005) AS geom
   FROM multiPoly;
 -- Results
 --
 LABEL GEOM
 ----- ----------------------------------------------------------------------------------------------------------------------------------------
 O     MDSYS.SDO_GEOMETRY(2007,NULL,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1,11,1003,1),MDSYS.SDO_ORDINATE_ARRAY(0,0,100,0,100,100,0,100,0,0,110,110,150,110,150,150,110,150,110,110))
 PNTS  MDSYS.SDO_GEOMETRY(2007,NULL,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,2,11,1003,2),MDSYS.SDO_ORDINATE_ARRAY(130,125,135,130,130,135,125,130,130,125,50,45,55,50,50,54.9999999999999,45,50,50,45))

I hope this continues to be useful to those users of my centroid package and others reading this for the first time.sql