Oracle Spatial is an integrated set of functions and procedures that enables spatial data to be stored, accessed, and analyzed quickly and efficiently in an Oracle database.

Geographic features can be represented in:

• vector
• or raster format,
• or both.

With vector data, points are represented by their explicit x,y,z coordinates, lines are strings of points, and areas are represented as polygons whose borders are lines. This kind of vector format can be used to record precisely the location and shape of spatial objects.

With raster data, you can represent spatial objects by assigning values to the cells that cover the objects, and you can represent the cells as arrays. This kind of raster format has less precision than vector format, but it is ideal for many types of spatial analysis. In the raster geographic information systems (GIS) world, this kind of raster data is normally called gridded data.

Oracle Locator is a cut down version of Oracle Spatial Standard Edition (SE/SE1) database installations.

## 3 - What is it ?

Oracle Spatial consists of a set of:

• object data types,
• type methods,
• and operators,
• functions,
• and procedures that use these types.

A geometry is stored as an object, in a single row, in a column of type SDO_GEOMETRY. Spatial index creation and maintenance is done using basic DDL (CREATE, ALTER, DROP) and DML (INSERT, UPDATE, DELETE) statements.

Spatial (like locator) is not designed to be an end-user application, but is a set of spatial capabilities for application developers.

The goal is to answer to any “WHERE” question, for example :

• where the cola is most preferred by residents,
• where the manufacturer believes the cola has growth potential, and so on …

## 4 - SDO Geometry Method

 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_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 Section 6.7.1.1) 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 Section 1.5.5.) 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 Chapter 15.

## 5 - Unit of Measurement Support

The default unit of measure is the one associated with the georeferenced coordinate system.

The unit of measure for most coordinate systems is the meter, and in these cases the default unit for distances is meter and the default unit for areas is square meter. By using the unit parameter, however, you can have Spatial automatically convert and return results that are more meaningful to application users, for example, displaying the distance to a restaurant in miles.

SELECT c.name, SDO_GEOM.SDO_LENGTH(c.shape, m.diminfo, 'unit=KM')
WHERE m.table_name = 'COLA_MARKETS_CS' AND m.column_name = 'SHAPE';

Spatial uses the information in the SDO_UNITS_OF_MEASURE table.

For convenience, you can also use the following legacy views to see the angle, area, and distance units of measure:

• MDSYS.SDO_ANGLE_UNITS
• MDSYS.SSDO_AREA_UNITS
• MDSYS.SSDO_DIST_UNITS

## 6 - Release of Spatial

To check which release of Spatial you are running, use the SDO_VERSION function. For example:

SQL> SELECT SDO_VERSION FROM DUAL;

SDO_VERSION
------------------------------------------
10.2.0.4.0

## 7 - Configuration Verification

CONNECT / AS sysdba