Friday, October 26, 2018

When SDO_GEOM.SDO_AREA returns a negative value

Always check out the original article at http://www.oraclequirks.com for latest comments, fixes and updates.

If function SDO_GEOM.SDO_AREA returns a negative number chances are that your geometry is invalid.

For instance I checked the geometry with function SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT and it returned:

13349 [Element <1>] [Ring <1>][Edge <2>][Edge <1>]

which means that the polygon boundary crosses itself.
The same applies when code 13356 is returned (adjacent points in a geometry are redundant).

Please note that the absolute value is still correct.
In most cases you should be able to fix the geometry by applying function SDO_GEOM.SDO_SELF_UNION.

This happens on Oracle 12.1

See message translations for ORA-13349, ORA-13356 and search additional resources.

No comments:

Post a Comment

I appreciate your comment however bear in mind that I might not have the time to reply soon.
Normally I do not reply to all comments but I am glad if you found something useful or if you learned something new, in that case I strongly encourage you to promote the article with the +1 google button.
Flavio