21.6 SDO_AGGR_MBR
Format
SDO_AGGR_MBR( geom SDO_GEOMETRY ) RETURN SDO_GEOMETRY;
Description
Returns the minimum bounding rectangle (MBR) of the specified geometries, that is, a single rectangle that minimally encloses the geometries.
Usage Notes
Note:
SDO_AGGR_MBR function is not supported in Oracle Autonomous Database Serverless deployments.This function does not return an MBR geometry if a proper MBR cannot be constructed. Specifically:
-
If the input geometries are all null, the function returns a null geometry.
-
If all data in the input geometries is on a single point, the function returns the point.
-
If all data in the input geometries consists of points on a straight line, the function returns a two-point line.
The SDO_TUNE.EXTENT_OF function, documented in SDO_TUNE Package (Tuning), also returns the MBR of geometries. The SDO_TUNE.EXTENT_OF function has better performance than the SDO_AGGR_MBR function if a spatial index is defined on the geometry column; however, the SDO_TUNE.EXTENT_OF function is limited to two-dimensional geometries, whereas the SDO_AGGR_MBR function is not. In addition, the SDO_TUNE.EXTENT_OF function computes the extent for all geometries in a table; by contrast, the SDO_AGGR_MBR function can operate on subsets of rows.
Examples
The following example returns the minimum bounding rectangle of the geometry objects in the COLA_MARKETS table. (The example uses the definitions and data from Simple Example: Inserting_ Indexing_ and Querying Spatial Data.)
SELECT SDO_AGGR_MBR(shape) FROM cola_markets; SDO_AGGR_MBR(C.SHAPE)(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SD -------------------------------------------------------------------------------- SDO_GEOMETRY(2003, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 3), SDO_ORDINATE_ARR AY(1, 1, 10, 11))
Parent topic: Spatial Aggregate Functions