English

FAQ: What tolerance value should be used when validating SDO geometry?

Question

What tolerance value should be used when validating SDO geometry?

Answer

When validating a SDO_Geometry feature class with a tolerance value, the feature class XY Tolerance must be used. This value can be obtained from the Feature Class Properties window by right-clicking the feature class in ArcCatalog and selecting Properties > Domain, Resolution and Tolerance.
[O-Image]
When using the Oracle SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT function, either a specific tolerance or a DIMINFO array can be used. In some cases, the tolerance in the DIMINFO array does not match the XY cluster tolerance of the feature class.

SDO_GEOM Package (Geometry)

SQL> SELECT DISTINCT(DIM.SDO_TOLERANCE)
2 FROM USER_SDO_GEOM_METADATA META,
3 TABLE(META.DIMINFO) DIM
4 WHERE TABLE_NAME = 'SDO_LINES';

SDO_TOLERANCE
-------------
.001
SQL> SELECT SP.XYCLUSTER_TOL
2 FROM SDE.LAYERS LY
3 JOIN SDE.SPATIAL_REFERENCES SP
4 ON LY.SRID = SP.SRID
5 WHERE TABLE_NAME = 'SDO_LINES';

XYCLUSTER_TOL
-------------
.003280833



This can cause problems when attempting to identify invalid SDO features. A tolerance that is too high may return false errors. Similarly, if a tolerance is too low, the validation may fail to return errors. This can be seen in the following example.

SQL> SELECT OBJECTID, SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(FC.SHAPE, META.DIMINFO) INVALID
2 FROM SDE.SDO_LINES FC,
3 USER_SDO_GEOM_METADATA META
4 WHERE SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(FC.SHAPE, META.DIMINFO) <> 'TRUE'
5 AND META.TABLE_NAME = 'SDO_LINES';

no rows selected
SQL> SELECT OBJECTID, SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(FC.SHAPE, 0.00328083) INVALID
2 FROM SDE.SDO_LINES FC
3 WHERE SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(FC.SHAPE, 0.00328083) <> 'TRUE';

OBJECTID INVALID
---------- --------------------------------------------------
2 13356 [Element <1>] [Coordinate <1>]



In this example, the tolerance from the DIMINFO array is used in the first query. This tolerance has a value of 0.001; this returns no errors. However, when the feature class XY cluster tolerance is used, an error is returned. This is because the distance between the vertices is smaller than the minimum distance specified in the XY cluster tolerance. If one coordinate is within the tolerance value of another, they are interpreted as being at the same location.