Tuesday, January 22, 2008

Get Area and Length of Features Stored in Oracle Spatial

The area and length of features are not pre-calculated and stored by Oracle’s SDO_GEOMETRY data type constructor functions. SDO_GEOMETRY type does not have places to store area and length values.

Geometric functions SDO_GEO.SDO_AREA and SDO_GEOM.SDO_LENGTH can be used to calculate the values in SQL queries when needed.

-- calculate the area
SELECT OBJECTID, SDO_GEOM.SDO_AREA(SHAPE, 0.005) FROM THE_LAYER;

-- calculate the length
SELECT OBJECTID, SDO_GEOM.SDO_LENGTH(SHAPE, 0.005) FROM THE_LAYER;

0.005 is the tolerance.

No comments:

Post a Comment