2.3 SDO_GEOMETRY Methods
The SDO_GEOMETRY object type has methods (member functions) that retrieve information about a geometry object.
Table 2-5 lists these methods.
Table 2-5 SDO_GEOMETRY Methods
| Name | Returns | Description |
|---|---|---|
|
NUMBER |
Returns the number of dimensions of a geometry object, as specified in its SDO_GTYPE value. In Oracle Spatial, the Get_Dims and ST_CoordDim methods return the same result. |
|
|
CLOB |
Returns the GeoJSON representation of a geometry object. |
|
|
NUMBER |
Returns the geometry type of a geometry object, as specified in its SDO_GTYPE value. |
|
|
NUMBER |
Returns the measure dimension of an LRS geometry object, as specified in its SDO_GTYPE value. A return value of 0 indicates that the geometry is a standard (non-LRS) geometry, or is an LRS geometry in the format before release 9.0.1 and with measure as the default (last) dimension; 3 indicates that the third dimension contains the measure information; 4 indicates that the fourth dimension contains the measure information. |
|
|
BLOB |
Returns the well-known binary (WKB) format of a geometry object. (The returned object does not include any SRID information.) |
|
|
CLOB |
Returns the well-known text (WKT) format (explained in Well-Known Text (WKT)) of a geometry object. (The returned object does not include any SRID information.) |
|
|
NUMBER |
Returns the coordinate dimension (as defined by the ISO/IEC SQL Multimedia standard) of a geometry object. In Oracle Spatial, the Get_Dims and ST_CoordDim methods return the same result. |
|
|
NUMBER |
Returns 0 if a geometry object is invalid or 1 if it is valid. (The ISO/IEC SQL Multimedia standard uses the term well formed for valid in this context.) This method uses 0.001 as the tolerance value. (Tolerance is explained in Tolerance.) To specify a different tolerance value or to learn more about why a geometry is invalid, use the SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT function, which is documented in SDO_GEOM Package (Geometry). |
Example 2-4 shows most of the SDO_GEOMETRY methods. (The Get_WKB method is not included because its output cannot be displayed by SQL*Plus.)
Example 2-4 SDO_GEOMETRY Methods
SELECT c.shape.Get_Dims()
FROM cola_markets c WHERE c.name = 'cola_b';
C.SHAPE.GET_DIMS()
------------------
2
SELECT c.shape.Get_GeoJson()
FROM cola_markets c WHERE c.name = 'cola_b';
C.SHAPE.GET_GEOJSON()
--------------------------------------------------------------------------------
{ "type": "Polygon", "coordinates": [ [ [5, 1], [8, 1], [8, 6], [5, 7], [5, 1] ]
SELECT c.shape.Get_GType()
FROM cola_markets c WHERE c.name = 'cola_b';
C.SHAPE.GET_GTYPE()
-------------------
3
SELECT a.route_geometry.Get_LRS_Dim()
FROM lrs_routes a WHERE a.route_id = 1;
A.ROUTE_GEOMETRY.GET_LRS_DIM()
------------------------------
3
SELECT c.shape.Get_WKT()
FROM cola_markets c WHERE c.name = 'cola_b';
C.SHAPE.GET_WKT()
--------------------------------------------------------------------------------
POLYGON ((5.0 1.0, 8.0 1.0, 8.0 6.0, 5.0 7.0, 5.0 1.0))
SELECT c.shape.ST_CoordDim()
FROM cola_markets c WHERE c.name = 'cola_b';
C.SHAPE.ST_COORDDIM()
---------------------
2
SELECT c.shape.ST_IsValid()
FROM cola_markets c WHERE c.name = 'cola_b';
C.SHAPE.ST_ISVALID()
--------------------
1 Parent topic: Spatial Data Types and Metadata