25.14 SDO_GEOM.SDO_DIFFERENCE
Format
SDO_GEOM.SDO_DIFFERENCE( geom1 IN SDO_GEOMETRY, dim1 IN SDO_DIM_ARRAY, geom2 IN SDO_GEOMETRY, dim2 IN SDO_DIM_ARRAY ) RETURN SDO_GEOMETRY;
or
SDO_GEOM.SDO_DIFFERENCE( geom1 IN SDO_GEOMETRY, geom2 IN SDO_GEOMETRY, tol IN NUMBER ) RETURN SDO_GEOMETRY;
Description
Returns a geometry object that is the topological difference (MINUS operation) of two geometry objects.
Parameters
- geom1
-
Geometry object.
- dim1
-
Dimensional information array corresponding to
geom1
, usually selected from one of the xxx_SDO_GEOM_METADATA views (described in Geometry Metadata Views). - geom2
-
Geometry object.
- dim2
-
Dimensional information array corresponding to
geom2
, usually selected from one of the xxx_SDO_GEOM_METADATA views (described in Geometry Metadata Views). - tol
-
Tolerance value (see Tolerance).
Usage Notes
In Figure 25-2, the shaded area represents the polygon returned when SDO_DIFFERENCE is used with a square (geom1
) and another polygon (geom2
).
An exception is raised if geom1
and geom2
are based on different coordinate systems.
Examples
The following example returns a geometry object that is the topological difference (MINUS operation) of cola_a
and cola_c
. (The example uses the definitions and data from Simple Example: Inserting_ Indexing_ and Querying Spatial Data.)
-- Return the topological difference of two geometries. SELECT SDO_GEOM.SDO_DIFFERENCE(c_a.shape, m.diminfo, c_c.shape, m.diminfo) FROM cola_markets c_a, cola_markets c_c, user_sdo_geom_metadata m WHERE m.table_name = 'COLA_MARKETS' AND m.column_name = 'SHAPE' AND c_a.name = 'cola_a' AND c_c.name = 'cola_c'; SDO_GEOM.SDO_DIFFERENCE(C_A.SHAPE,M.DIMINFO,C_C.SHAPE,M.DIMINFO)(SDO_GTYPE, SDO_ -------------------------------------------------------------------------------- SDO_GEOMETRY(2003, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1), SDO_ORDINATE_ARR AY(1, 7, 1, 1, 5, 1, 5, 3, 3, 3, 4, 5, 5, 5, 5, 7, 1, 7)
Note that in the returned polygon, the SDO_ORDINATE_ARRAY starts and ends at the same point (1, 7).
Related Topics
Parent topic: SDO_GEOM Package (Geometry)