25.6 SDO_GEOM.SDO_CENTROID
Format
SDO_GEOM.SDO_CENTROID( geom1 IN SDO_GEOMETRY, dim1 IN SDO_DIM_ARRAY ) RETURN SDO_GEOMETRY;
or
SDO_GEOM.SDO_CENTROID( geom1 IN SDO_GEOMETRY, tol IN NUMBER ) RETURN SDO_GEOMETRY;
Description
Returns a point geometry that is the centroid of a polygon, multipolygon, point, or point cluster. (The centroid is also known as the "center of gravity.")
For an input geometry consisting of multiple objects, the result is weighted by the area of each polygon in the geometry objects. If the geometry objects are a mixture of polygons and points, the points are not used in the calculation of the centroid. If the geometry objects are all points, the points have equal weight.
Parameters
- geom1
-
Geometry object.
- dim1
-
Dimensional information array corresponding to
geom
, usually selected from one of the xxx_SDO_GEOM_METADATA views (described in Geometry Metadata Views). - tol
-
Tolerance value (see Tolerance).
Usage Notes
The function returns a null value if geom1
is not a polygon, multipolygon, point, or point cluster, as identified by the SDO_GTYPE value in the SDO_GEOMETRY object.
If geom1
is a point, the function returns the point (the input geometry).
With geodetic data, this function is supported by approximations, as explained in Functions Supported by Approximations with Geodetic Data.
Depending on the shape and complexity of the input geometry, the returned point might not be on the surface of the input geometry.
Examples
The following example returns a geometry object that is the centroid of cola_c
. (The example uses the definitions and data from Simple Example: Inserting_ Indexing_ and Querying Spatial Data.)
-- Return the centroid of a geometry. SELECT c.name, SDO_GEOM.SDO_CENTROID(c.shape, m.diminfo) FROM cola_markets c, user_sdo_geom_metadata m WHERE m.table_name = 'COLA_MARKETS' AND m.column_name = 'SHAPE' AND c.name = 'cola_c'; NAME -------------------------------- SDO_GEOM.SDO_CENTROID(C.SHAPE,M.DIMINFO)(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z) -------------------------------------------------------------------------------- cola_c SDO_GEOMETRY(2001, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1, 1), SDO_ORDINATE_ARRAY( 4.73333333, 3.93333333))
Related Topics
None.
Parent topic: SDO_GEOM Package (Geometry)