Format
SDO_GEOM.SDO_MBR( geom IN SDO_GEOMETRY [, dim IN SDO_DIM_ARRAY] ) RETURN SDO_GEOMETRY;
Description
Returns the minimum bounding rectangle of a geometry object, that is, a single rectangle that minimally encloses the geometry.
Note:
SDO_GEOM_MBR is a SQL operator that is functionally identical to this function, but provides better performance. See SDO_GEOM_MBR Operator Alternative for Better Performance under Usage Notes for more information.
Parameters
Geometry object.
Dimensional information array corresponding to geom
, usually selected from one of the xxx_SDO_GEOM_METADATA views (described in Geometry Metadata Views).
Usage Notes
This function does not return an MBR geometry if a proper MBR cannot be constructed. Specifically:
If the input geometry is null, the function returns a null geometry.
If the input geometry is a point, the function returns the point.
If the input geometry consists of points all on a straight line, the function returns a two-point line.
If the input geometry has three dimensions but all Z dimension values are the same, the function returns a three-dimensional line.
SDO_GEOM_MBR Operator Alternative for Better Performance
SDO_GEOM_MBR is a SQL operator that is functionally identical to the SDO_GEOM.SDO_MBR function, but provides better performance.
The SDO_GEOM_MBR operator must be used within a SQL query, such as:
SELECT sdo_geom_mbr(geom) INTO g FROM DUAL;
You can also use multiple SDO_GEOM_MBR operators in the same query For example:
SELECT sdo_geom_mbr(geom1), sdo_geom_mbr(geom2) INTO g1, g2 FROM DUAL;
See also the example of the SDO_GEOM_MBR operator under Examples.
Examples
The following example returns the minimum bounding rectangle of the cola_d
geometry in the COLA_MARKETS table. (The example uses the definitions and data from Simple Example: Inserting_ Indexing_ and Querying Spatial Data. Because cola_d
is a circle, the minimum bounding rectangle in this case is a square.)
-- Return the minimum bounding rectangle of cola_d (a circle). SELECT SDO_GEOM.SDO_MBR(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_d'; SDO_GEOM.SDO_MBR(C.SHAPE,M.DIMINFO)(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO -------------------------------------------------------------------------------- SDO_GEOMETRY(2003, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 3), SDO_ORDINATE_ARR AY(6, 7, 10, 11))
The following example if functionally identical to the preceding one, except that it uses the SDO_GEOM_MBR operator.
-- Return the minimum bounding rectangle of cola_d (a circle). SELECT SDO_GEOM_MBR(c.shape) FROM cola_markets c WHERE c.name = 'cola_d'; SDO_GEOM_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(6, 7, 10, 11))
Related Topics