25.32 SDO_GEOM.SDO_XOR
Format
SDO_GEOM.SDO_XOR( geom1 IN SDO_XOR, dim1 IN SDO_DIM_ARRAY, geom2 IN SDO_GEOMETRY, dim2 IN SDO_DIM_ARRAY ) RETURN SDO_GEOMETRY;
or
SDO_GEOM.SDO_XOR( geom1 IN SDO_GEOMETRY, geom2 IN SDO_GEOMETRY, tol IN NUMBER ) RETURN SDO_GEOMETRY;
Description
Returns a geometry object that is the topological symmetric difference (XOR 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-5, the shaded area represents the polygon returned when SDO_XOR 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 symmetric difference (XOR 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 symmetric difference of two geometries. SELECT SDO_GEOM.SDO_XOR(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_XOR(C_A.SHAPE,M.DIMINFO,C_C.SHAPE,M.DIMINFO)(SDO_GTYPE, SDO_SRID, S -------------------------------------------------------------------------------- SDO_GEOMETRY(2007, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1, 19, 1003, 1), SDO _ORDINATE_ARRAY(1, 7, 1, 1, 5, 1, 5, 3, 3, 3, 4, 5, 5, 5, 5, 7, 1, 7, 5, 5, 5, 3 , 6, 3, 6, 5, 5, 5))
Note that the returned polygon is a multipolygon (SDO_GTYPE = 2007), and the SDO_ORDINATE_ARRAY describes two polygons: one starting and ending at (1, 7) and the other starting and ending at (5, 5).
Related Topics
Parent topic: SDO_GEOM Package (Geometry)