4 Replies Latest reply: May 1, 2007 12:42 PM by 510467 RSS

    How to resolve VALIDATE_GEOMETRY_WITH_CONTEXT 'errors'?

      I have some problem to select my spatial data (see Result of sdo_within_distance ). Sometime I select data and my database connection will be separated (ORA-03113, ORA-03114).

      Now I try to analys my data with VALIDATE_GEOMETRY_WITH CONTEXT:

      FROM protection_area.sk_2006_spa c

      Here a part of the result:

      1     SKCHVU002     13348 [Element <1>] [Ring <2>]
      2     SKCHVU003     13349 [Element <1>] [Ring <1>][Edge <5247>][Edge <5252>]
      3     SKCHVU004     13367 [Element <5>] [Ring <1>]
      4     SKCHVU009     13348 [Element <1>] [Ring <14>]
      5     SKCHVU010     13348 [Element <2>] [Ring <1>]
      6     SKCHVU013     13348 [Element <1>] [Ring <8>]
      7     SKCHVU015     13348 [Element <6>] [Ring <7>]
      8     SKCHVU016     13349 [Element <3>] [Ring <1>][Edge <2175>][Edge <2178>]
      9     SKCHVU017     13367 [Element <5>] [Ring <2>]
      10     SKCHVU018     13349 [Element <9>] [Ring <1>][Edge <5368>][Edge <5370>]
      11     SKCHVU019     13348 [Element <14>] [Ring <29>]
      12     SKCHVU021     13367 [Element <1>] [Ring <1>]
      13     SKCHVU025     13367 [Element <1>] [Ring <13>]

      What can I do to avoid this 'errors'?

      I already tried this:
      UPDATE protection_area.sk_2006_spa c

      Any hints?

        • 1. Re: How to resolve VALIDATE_GEOMETRY_WITH_CONTEXT 'errors'?
          Luiz Soares

          You need to correct those geometries.

          I've got this from Oracle Spatial 10g User's Guide:
          Rings: A ring is only used with polygon elements. Exterior rings in a polygon are
          considered polygon elements, and an exterior ring can include zero or more
          interior rings (or holes). Each interior ring has its own ring designation, but Ring 1
          is associated with the exterior polygon itself. For example, Element 1, Ring 1 refers to the first exterior polygon in a geometry; Element 1, Ring 2 refers to the first interior polygon of the first exterior polygon; and Element 1, Ring 3 refers to the second interior polygon. If the geometry is a multipolygon, Element 2, Ring 1 is
          used to refers to the second exterior polygon. If there are interior polygons
          associated with it, Element 2, Ring 2 refers to the first interior polygon of the
          second exterior polygon.

          Edges: An edge refers to a line segment between two coordinates. Edge 1 refers to the segment between coordinate 1 and coordinate 2, Edge 2 refers to the line segment between coordinates 2 and 3, and so on. The most common place to see edge errors when validating geometries is with self-intersecting polygons. (The Open Geospatial Consortium simple features specification does not allow a
          polygon to self-intersect.) In such cases, Oracle reports error 13349 (polygon
          boundary crosses itself), including the Element, Ring, and Edge numbers where
          self-intersection occurs.

          Hope it helps,

          • 2. Re: How to resolve VALIDATE_GEOMETRY_WITH_CONTEXT 'errors'?
            John O'Toole
            Try running SDO_MIGRATE.TO_CURRENT - that should get rid of your ORA-13367 errors.

            ORA-13348 means that the polygon boundary is not closed
            Visually check the data - is the polygon boundary open? If there is a gap, then check the distance of it - you may have a tolerance issue.
            • 3. Re: How to resolve VALIDATE_GEOMETRY_WITH_CONTEXT 'errors'?
              13348 means: polygon boundary is not closed. Thus you need to make sure first vertex and last vertex are the same in your polygon defn.

              13349 means polygon boundary crosses itself. You need to make sure no edges of the polygon intersect. In your case Edge# 5247 and Edge# 5252 intersect.

              13367 means wrong orientation for interior/exterior rings. Thus, you need to make sure the exterior rings are oriented counterclockwise and the interior rings are oriented clockwise.

              If you fix these, your geometry will be valid.
              Please let us know if you have further questions.
              best regards,
              • 4. Re: How to resolve VALIDATE_GEOMETRY_WITH_CONTEXT 'errors'?
                After migrating the geometries you might want to try sdo_util.rectify_geometry.

                It will do its best to fix broken geometries (sometimes it can, sometimes it can't).

                I would not do a global update based on the results of rectify geometry. Instead I would look at the results to make sure the geometries looked correct before updating them in the database.

                Kind regards,