SDO_GEOMETRY Methods

The SDO_GEOMETRY object type has methods (member functions) that retrieve information about a geometry object. Table: SDO_GEOMETRY Methods lists these methods.

Table: SDO_GEOMETRY Methods

Name Returns Description
Get_Dims 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.
Get_GeoJson CLOB Returns the GeoJSON representation of a geometry object.
Get_GType NUMBER Returns the geometry type of a geometry object, as specified in its SDO_GTYPE value.
Get_LRS_Dim 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.

Get_WKB BLOB Returns the well-known binary (WKB) format of a geometry object. (The returned object does not include any SRID information.)
Get_WKT 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.)
ST_CoordDim 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.
ST_IsValid 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: SDO_GEOMETRY Methods shows most of the SDO_GEOMETRY methods. (The Get_WKB method is not included because its output cannot be displayed by SQL*Plus.)

Example: 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