English

FAQ: How can I get the area and length of features stored in Oracle Spatial?

Question

How can I get the area and length of features stored in Oracle Spatial?

Answer

Oracle's SDO_GEOMETRY data type constructor functions do not pre-calculate and store the area or length of features. There is no place in the SDO_GEOMETRY type to persist area and length. Instead, Oracle Spatial provides the geometric functions SDO_GEOM.SDO_AREA and SDO_GEOM.SDO_LENGTH to calculate these values when needed. These functions can be used to build SQL queries that need area or length. For example:

Code:
SELECT OBJECTID,
SDO_GEOM.SDO_AREA(SHAPE, 0.005)
FROM MYTABLE;

The value '0.005' is the tolerance used in the calculation. Refer to the Oracle Spatial Users Guide and Reference for more information.

Since area and length are often used, ArcSDE compressed binary, IBM DB2 Spatial Extender and Informix Spatial DataBlade automatically calculate and store these values while storing validated features. Users only access these validated features through ArcSDE or through the DB2 and Informix SQL interfaces, assuring that each shape is valid when it is stored, and that the area and length values stored for each feature are correct.