15
Geometry Functions and Procedures
This chapter contains descriptions of the geometric functions and procedures shown in Table 15-1.
This chapter refers to the relational Spatial model only.
SDO_GEOM.RELATE
Purpose
This function examines two geometry objects to determine their spatial relationship. It is available in two forms. See the Usage Notes for more information.
Syntax
SDO_GEOM.RELATE (layername1, SDO_GID1, mask, [layername2,] SDO_GID2)
SDO_GEOM.RELATE (layername1, SDO_GID1, mask, X_tolerance, Y_tolerance,
SDO_ETYPE, num_ordinates, X_ordinate1, Y_ordinate1 [,...,Xn, Yn]
[,SDO_ETYPE, num_ordinates, X_ordinate1, Y_ordinate1 [,...,Xn, Yn]])
Keywords and Parameters
Returns
The SDO_GEOM.RELATE() function can return three types of answers:
- If you pass a mask listing one or more relationships, the function returns the name of the relationship if it is true for the pair of geometries. If all of the relationships are false, the function returns FALSE.
- If you pass the DETERMINE keyword in the mask, the function returns the one relationship keyword that best matches the geometries. DETERMINE can only be used when
SDO_GEOM.RELATE()
is in the SELECT clause of the SQL statement.
- If you pass the ANYINTERACT keyword in the mask, the function returns TRUE if the two geometries are not disjoint.
The data type is VARCHAR2.
Usage Notes
Use the first form of the function to examine two stored geometric objects.
Use the second form of the function to compare a stored object against a user-defined object. You can specify up to 123 vertices for a single-element geometry. If the geometry has multiple elements, the total number of arguments passed, including SDO_ETYPE, num_ordinates, and the list of vertex coordinates, cannot exceed 255 values.
The following relationships can be tested:
- ANYINTERACT - Returns TRUE if the objects are not disjoint.
- CONTAINS - Returns CONTAINS if the second object is entirely within the first object and the object boundaries do not touch; otherwise, returns FALSE.
- COVEREDBY - Returns COVEREDBY if the first object is entirely within the second object and the object boundaries touch at one or more points; otherwise, returns FALSE.
- COVERS - Returns COVERS if the second object is entirely within the first object and the boundaries touch in one or more places; otherwise, returns FALSE.
- DISJOINT - Returns DISJOINT if the objects have no common boundary or interior points; otherwise, returns FALSE.
- EQUAL - Returns EQUAL if the objects share every point of their boundaries and interior, including any holes in the objects; otherwise, returns FALSE.
- INSIDE - Returns INSIDE if the first object is entirely within the second object and the object boundaries do not touch; otherwise, returns FALSE.
- OVERLAPBDYDISJOINT - Returns OVERLAPBDYDISJOINT if the objects overlap, but their boundaries do not interact; otherwise, returns FALSE.
- OVERLAPBDYINTERSECT - Returns OVERLAPBDYINTERSECT if the objects overlap, and their boundaries intersect in one or more places; otherwise, returns FALSE.
- TOUCH - Returns TOUCH if the two objects share a common boundary point, but no interior points; otherwise, returns FALSE.
Mask values can be combined using the logical Boolean operator OR. For example, `INSIDE + TOUCH' returns either 'INSIDE', 'TOUCH', or 'FALSE' depending on the outcome of the test.
Related Topics
None.
SDO_GEOM.VALIDATE_GEOM
Purpose
This function provides a consistency check for valid geometry types. The function checks the representation of the geometry from the tables against the element definitions.
Syntax
SDO_GEOM.VALIDATE_GEOM (layername,SDO_GID)
Keywords and Parameters
Returns
This function returns one of the following:
- TRUE if the geometry is valid.
- FALSE if the geometry is invalid for some unknown reason.
- An Oracle error number indicating the problem with the geometry.
The data type is VARCHAR2.
Usage Notes
This function checks for the following:
- Polygons have at least three points and must be closed
- Line strings must have at least two points
- When an SDO_ESEQ spans multiple rows, the last point of the previous row is the first point on the next row
Related Topics
None.
SDO_GEOM.VALIDATE_LAYER
Purpose
This function examines a layer to determine if the stored geometries follow the defined rules for geometric objects.
Syntax
SDO_GEOM.VALIDATE_LAYER (layername, result_table)
Keywords and Parameters
Returns
This function fills the result table with validation results.
Usage Notes
Create an empty result table prior to calling this function. The format of the result table is: (sdo_gid number, result varchar2).
This function checks for the following:
- Polygons have at least three points and must be closed
- Line strings must have at least two points
- When an SDO_ESEQ spans multiple rows, the last point of the previous row is the first point on the next row
Related Topics
None.