Validate_Geometry_With_Context

Hi,
I have a polygon which shows a self intersection with Validate_Geometry_With_Context. The boundary does not mathematically self intersect but a node is within the tolerance of an edge in same polygon.
I was wondering how Oracle checks for self intersection.
Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
PL/SQL Release 9.2.0.8.0 - Production
CORE     9.2.0.8.0     Production
TNS for Linux: Version 9.2.0.8.0 - Production
NLSRTL Version 9.2.0.8.0 - Production
Regards.
Ivan

Siva,
Thanks for that.
The problem I have is that there is an application holding modelled data for flooding. The application uses Validate_Geometry_With_Context to check data before it is uploaded. It is failing with a
13349 [Element <1>] [Ring <1>][Edge <2873>][Edge <2876>] error.
This is not giving enough information for a user to remove the problem.
I am trying to use a package (FME or Radius Studio) to check the data before loading. I will also write something. If I know what the mathematics is.
Regards.
Ivan

Similar Messages

  • Format of VALIDATE_GEOMETRY_WITH_CONTEXT output

    Hi,
    I'm trying to write a generic routine to display validation errors (e.g. show the geometry with the erroneous segments highlighted), with the aim to more easily correct them.
    What I am wondering is, is there are documentation on the format of the context information output by VALIDATE_GEOMETRY_WITH_CONTEXT, as there are several outputs produced
    e.g.
    13356 [Element <1>] [Coordinate <4>][Ring <1>]
    13349 [Element <1>] [Ring <1>][Edge <6>][Edge <21>]
    I can decipher these specific errors, but a definitive reference would be appreciated.
    thanks in advance,
    Andrew

    Hi Andrew,
    I know this is hard, but it is a great improvement from earlier, when Oracle didn't report any location information.
    The reference for the numbers (13356 or 13349) is the error messages documentation.
    ORA-13349: polygon boundary crosses itself
    Cause: The boundary of a polygon intersects itself.
    Action: Correct the geometric definition of the object.
    ORA-13356: adjacent points in a geometry are redundant
    Cause: There are repeated points in the sequence of coordinates.
    Action: Remove the redundant point.
    The rest of the information is an attempt to help you locate where in the geometry the problem was found.
    13356 [Element <1>] [Coordinate <4>][Ring <1>]
    The first element in SDO_ORDINATE array is the one with the problem
    The 4th vertex is a duplicate of the 5th vertex (falls within the specified tolerance so the two coordinates are considered the same).
    Ring 1 - The first element is a polygon, and a single polygon can consist of an exterior ring with one or more holes (interior rings). Since this is ring 1, it is the exterior ring associated with the first element. If it was Ring 2, it would be the first hole, ring 3 would be the second hole, and so on.
    13349 [Element <1>] [Ring <1>][Edge <6>][Edge <21>]
    With this error the first ring (exterior ring) of the first element in the sdo_ordinate_array has edges that self intersect. The edges are edge 6 and edge 21. The edges can be identifed as the 6th and 7th vertices (edge 6) and the 21st and 22nd vertices.
    You can use sdo_util.get_vertices to look at coordinate pairs.
    There is also sdo_util.remove_duplicate_vertices to get rid of the duplicate vertex errors.
    Sometimes I union a geometry with itself to see if Oracle can fix an invalid polygon whose edges intersect (this isn't guaranteed to work because operations on invalid geometries aren't supported), but if it succeeds I look at the input and output geometries together and if I am convinced they are the same then I put the new geometry back into the table.
    Hope this helps,
    Dan

  • SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT and "NULL" in SDO_GEOMETRY

    For the table N_GEOM we have in the SDO_GEOM_METADATA_TABLE:
    table_name: N_GEOM
    geometry_column: SHAPE
    diminfo: SDO_DIM_ARRAY(SDO_DIM_ELEMENT('LONGITUDE', -180, 180, .001), SDO_DIM_ELEMENT('LATITUDE', -90, 90, .001))
    srid: 8307
    If we validate the geometry SDO_GEOMETRY(NULL, 8307, NULL, NULL, NULL)
    we get:
    SQL> select sdo_geom.validate_geometry_with_context(SDO_GEOMETRY(NULL, 8307, NULL, NULL, NULL),
    2 diminfo)
    3 from user_sdo_geom_metadata where table_name='N_GEOM';
    SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(SDO_GEOMETRY(NULL,8307,NULL,NULL,NULL),D
    NULL
    SQL> select sdo_geom.validate_geometry_with_context(NULL,
    2 diminfo)
    3 from user_sdo_geom_metadata where table_name='N_GEOM';
    SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(NULL,DIMINFO)
    NULL
    But if we use a tolerance value we get:
    SQL> select sdo_geom.validate_geometry_with_context
    2 (SDO_GEOMETRY(NULL, 8307, NULL, NULL, NULL),
    3 0.001) from dual;
    select sdo_geom.validate_geometry_with_context
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error
    ORA-06512: at "MDSYS.SDO_GEOM", line 70
    ORA-06512: at "MDSYS.SDO_GEOM", line 1851
    But witht NULL we get:
    SQL> select sdo_geom.validate_geometry_with_context
    2 (NULL,
    3 0.001) from dual;
    SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(NULL,0.001)
    NULL
    Why do we an error message for one these queries?

    There is no such SRID 2000303. However, this one sure looks like it does the same thing. Replace all the SRID values with 2320 and you should be set.
    SQL> select *
      2  from MDSYS.SDO_COORD_REF_SYSTEM
      3  where srid = 2320;
          SRID COORD_REF_SYS_NAME                                                              COORD_REF_SYS_KIND
    COORD_SYS_ID  DATUM_ID GEOG_CRS_DATUM_ID SOURCE_GEOG_SRID PROJECTION_CONV_ID CMPD_HORIZ_SRID CMPD_VERT_SRID
    INFORMATION_SOURCE
    DATA_SOURCE                              IS_LE LEGACY_CODE
    LEGACY_WKTEXT
    LEGACY_CS_BOUNDS(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
    IS_VA SUPPO
          2320 ED50 / TM30                                                                      PROJECTED
            4530                        6230            4230              16370
    General Command of Mapping via EuroGeographics; http://crs.ifag.de/
    EPSG                                    FALSE
    TRUE  TRUE

  • Sdo_geom.validate_geometry_with_context returns error for a valid polygon

    Hi people,
    I have found a strange case, where sdo_geom.validate_geometry_with_context returns an error:
    select sdo_geom.validate_geometry_with_context(SDO_GEOMETRY(2003, 8307, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1), SDO_ORDINATE_ARRAY(0.0, 51.9273, 0.3556, 51.9273, 0.3910, 51.9274, 0.1964, 51.9274, 0.0, 51.9273)), 1) from dual;
    13349 [Element <1>] [Ring <1>][Edge <3>][Edge <1>]
    The tolerance for SRID 8307 is in meters, right? The shape is a parallelogram, although the lat dimension is about 0.0001 grad or ~11 meters. Any hints why there is an error?
    // using Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    Edited by: Slava2 on May 27, 2013 3:12 AM

    You defined a spheric polygon in WGS84, that has a self intersection near <0.22945371630245; 51.9274226210077> :
    WITH l1 AS
    (SELECT SDO_GEOMETRY(2002, 8307, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1), SDO_ORDINATE_ARRAY(0.0000,51.9273, 0.3556,51.9273)) geom
        FROM dual),
        l2 AS
    (SELECT SDO_GEOMETRY(2002, 8307, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1), SDO_ORDINATE_ARRAY(0.3910,51.9274, 0.1964,51.9274)) geom
    FROM dual)
    SELECT  sdo_geom.sdo_intersection(l1.geom, l2.geom,0.00001) FROM l1, l2;
    (2001; 8307; ; (1; 1; 1); (0.22945371630245; 51.9274226210077))
    1 row selected.

  • How to resolve VALIDATE_GEOMETRY_WITH_CONTEXT 'errors'?

    Hello,
    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:
    SELECT c.SPA_CODE, SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(c.GEOM, 0.5)
    FROM protection_area.sk_2006_spa c
    WHERE SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(c.GEOM, 0.5)<>'TRUE'
    ORDER BY c.SPA_CODE
    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
    SET c.GEOM = SDO_UTIL.REMOVE_DUPLICATE_VERTICES(c.geom,0.5)
    Any hints?
    Thanks,
    matthias

    Hi,
    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,
    Luiz

  • VALIDATE_GEOMETRY_WITH_CONTEXT  Worked in 10g not in 11gR2 Database

    Within our application, the following call to SDO_VALIDATE_GEOMETRY_Context worked in our 10g database.
    Select SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(MDSYS.SDO_GEOMETRY(3001,8307, MDSYS.SDO_POINT_TYPE( 066.00000000, -34.00000000,-28.655),NULL,NULL), MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',-180,180,5E-8),MDSYS.SDO_DIM_ELEMENT('Y',-90,90,5E-8),MDSYS.SDO_DIM_ELEMENT('Z',-999999,999999,5E-8))) from dual
    But when the 11GR2 database was stood up against the application, it caused an ORA 54668. We would like the application to be 10g as well as 11GR2 compatable, so any suggestions would be gladly appreciated.
    Thanks in advance
    VB

    Hi Boatenv.
    You can read the following.
    select sdo_geom.validate_geometry_with_context(MDSYS.SDO_GEOMETRY(2002, NULL, NULL,
    MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1), MDSYS.SDO_ORDINATE_ARRAY(50.0, 15.0, 55.0, 15.0, 55.0, 15.0, 15.0, 60.0)),0.005) as contextError
    from dual;
    CONTEXTERROR
    13356 [Element <1>] [Coordinate <2>]
    -- Multiple duplicates in single linestring
    select sdo_geom.validate_geometry_with_context(MDSYS.SDO_GEOMETRY(2002, NULL, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1),
    MDSYS.SDO_ORDINATE_ARRAY(50.0, 15.0, 55.0, 15.0, 55.0, 15.0, 55.0, 15.0, 60.0, 15.0)),0.005) as contextError
    from dual;
    CONTEXTERROR
    13356 [Element <1>] [Coordinate <2>]
    -- Two duplicates in first element, single duplicate in second of multilinestring
    select sdo_geom.validate_geometry_with_context(MDSYS.SDO_GEOMETRY(2006, NULL, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1,7,2,1),
    MDSYS.SDO_ORDINATE_ARRAY(50.0, 15.0, 55.0, 15.0, 55.0, 15.0, 60.0, 15.0, 60.0, 15.0, 65.0, 15.0)),0.005) as contextError
    from dual;
    CONTEXTERROR
    13356 [Element <1>] [Coordinate <2>]
    -- No duplicates in first element, single duplicate in second of multilinestring
    select sdo_geom.validate_geometry_with_context(MDSYS.SDO_GEOMETRY(2006, NULL, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1,5,2,1),
    MDSYS.SDO_ORDINATE_ARRAY(50.0, 15.0, 55.0, 15.0, 60.0, 15.0, 60.0, 15.0, 65.0, 15.0)),0.005) as contextError
    from dual;
    CONTEXTERROR
    13356 [Element <2>] [Coordinate <1>]
    -- Triple duplicate in first element, single duplicate in second of multilinestring
    select sdo_geom.validate_geometry_with_context(MDSYS.SDO_GEOMETRY(2006, NULL, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1,9,2,1),
    MDSYS.SDO_ORDINATE_ARRAY(50.0, 15.0, 55.0, 15.0, 55.0, 15.0, 55.0, 15.0, 60.0, 15.0, 60.0, 15.0, 65.0, 15.0)),0.005) as contextError
    from dual;
    CONTEXTERROR
    13356 [Element <1>] [Coordinate <2>]
    I would have expected that all duplicate points would have been reported.
    Oracle should fix this, of course, but in the meantime, if I get time, I will write a function that reports all duplicate points.
    I hope this is of help to someone.
    and the following url
    Oracle 11 sdo_geom.validate_geometry_with_context ERROR
    Please let me know if this solved your problem.
    Regards,

  • Using SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT effectively

    I have been using SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT to validate the geometry of several million polygon features. Here is an example of the SQL I have been using:
    Create table myResultsTable
    as
    SELECT A.myID, SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(A.GEOMETRY, 0.1) as invalidGeometry, FROM myGeometryTable A
    WHERE SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(A.GEOMETRY, 0.1) <> 'TRUE';
    I noticed that for each polygon in the table, this function returns only one result for the polygon before moving on to the next polygon despite it being possible that a polygon could fail the validation for several reasons.
    How can I return all reasons why a polygon has invalid geometry?
    Does it require me to use PL/SQL? If so, can anyone get me started?
    Or does it require me to use SDO_GEOM.VALIDATE_LAYER_WITH_CONTEXT? If so, how do I specify a tolerance when using this function like I did when I used SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT?
    Many thanks for your time.

    Hi,
    The validation routines only report the first reason geometry data is invalid.
    To validate several million polygon features I would use validate_layer_with_context because it is faster.
    If you don't want to for some reason then alter your statement to only run the validation procedure once:
    select a.status,a.id
    from (SELECT m.myID id, SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(m.GEOMETRY, 0.1) status
    FROM myGeometryTable m) a
    where a.status <> 'TRUE';
    Then there are possibilities in terms of automatically trying to fix things up to move on to the next error. For instance, if you get a duplicate vertices error your run remove_duplicate_vertices to try to fix that error, then revalidate and see if there are other errors. If you have a self-intersecting geometrt then running a self union may fix those kinds of problems (in 10g r2 this is automated with sdo_util.rectify_geometry, which attempts to automatically fix these kinds of errors).
    NOTE: Always check results of any automated geometry fix-up procedures to make sure you agree with the results of the procedure. I would recommend against automatically updating your data without checking the results.
    Hope this helps,
    Dan

  • Oracle 11 sdo_geom.validate_geometry_with_context ERROR

    Hi forum,
    we've identified the following error in oralce spatial version 11.1.0.7.
    The only difference between the following statements is the fourth position of the sdo_ordinate_array (2568619.62 <-> 2568619.61)
    This is the result from an oracle 11.1.0.7 database:
    select sdo_geom.validate_geometry_with_context(MDSYS.SDO_GEOMETRY(3003,31466,null,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1,40,2003,1),
    MDSYS.SDO_ORDINATE_ARRAY(2568609.43,5653957,0,2568619.62,5653845.08,0,2568646.99,5653847.57,0,2568642.96,5653891.06,0,2568712.86,5653897.49,0,2568718.77,5653832.82,0,2568621.54,5653823.93,0,2568623.62,5653801.14,0,2568743.69,5653812.04,0,2568877.45,5653824.19,0,2568856.27,5654056,0,2568838.3,5654054.37,0,2568609.43,5653957,0,2568767.56,5654001.42,0,2568830.75,5654028.43,0,2568853.78,5654030.53,0,2568868.7,5653867.3,0,2568816.59,5653862.57,0,2568810.64,5653927.73,0,2568772.49,5653924.24,0,2568771.19,5653938.66,0,2568773.23,5653938.85,0,2568767.56,5654001.42,0)),0.0005) as val_stat from dual;
    VAL_STAT
    13367 Point:0,Edge:0,Ring:2,
    select sdo_geom.validate_geometry_with_context(MDSYS.SDO_GEOMETRY(3003,31466,null,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1,40,2003,1),
    MDSYS.SDO_ORDINATE_ARRAY(2568609.43,5653957,0,2568619.61,5653845.08,0,2568646.99,5653847.57,0,2568642.96,5653891.06,0,2568712.86,5653897.49,0,2568718.77,5653832.82,0,2568621.54,5653823.93,0,2568623.62,5653801.14,0,2568743.69,5653812.04,0,2568877.45,5653824.19,0,2568856.27,5654056,0,2568838.3,5654054.37,0,2568609.43,5653957,0,2568767.56,5654001.42,0,2568830.75,5654028.43,0,2568853.78,5654030.53,0,2568868.7,5653867.3,0,2568816.59,5653862.57,0,2568810.64,5653927.73,0,2568772.49,5653924.24,0,2568771.19,5653938.66,0,2568773.23,5653938.85,0,2568767.56,5654001.42,0)),0.0005) as val_stat from dual;
    VAL_STAT
    TRUE
    The result on oracle 10.2.0.1 is TRUE for both statements!
    Is this a known bug in oracle 11?
    Regards, Arnd.

    select sdo_geom.validate_geometry_with_context(MDSYS.SDO_GEOMETRY(3003,31466,null,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1,40,2003,1),
    MDSYS.SDO_ORDINATE_ARRAY(2568609.43,5653957,0,2568619.62,5653845.08,0,2568646.99,5653847.57,0,2568642.96,5653891.06,0,2568712.86,5653897.49,0,2568718.77,5653832.82,0,2568621.54,5653823.93,0,2568623.62,5653801.14,0,2568743.69,5653812.04,0,2568877.45,5653824.19,0,2568856.27,5654056,0,2568838.3,5654054.37,0,2568609.43,5653957,0,2568767.56,5654001.42,0,2568830.75,5654028.43,0,2568853.78,5654030.53,0,2568868.7,5653867.3,0,2568816.59,5653862.57,0,2568810.64,5653927.73,0,2568772.49,5653924.24,0,2568771.19,5653938.66,0,2568773.23,5653938.85,0,2568767.56,5654001.42,0)),0.0005) as val_stat_31466_feature_1 from dual;
    select sdo_geom.validate_geometry_with_context(MDSYS.SDO_GEOMETRY(3003,31466,null,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1,40,2003,1),
    MDSYS.SDO_ORDINATE_ARRAY(2568609.43,5653957,0,2568619.61,5653845.08,0,2568646.99,5653847.57,0,2568642.96,5653891.06,0,2568712.86,5653897.49,0,2568718.77,5653832.82,0,2568621.54,5653823.93,0,2568623.62,5653801.14,0,2568743.69,5653812.04,0,2568877.45,5653824.19,0,2568856.27,5654056,0,2568838.3,5654054.37,0,2568609.43,5653957,0,2568767.56,5654001.42,0,2568830.75,5654028.43,0,2568853.78,5654030.53,0,2568868.7,5653867.3,0,2568816.59,5653862.57,0,2568810.64,5653927.73,0,2568772.49,5653924.24,0,2568771.19,5653938.66,0,2568773.23,5653938.85,0,2568767.56,5654001.42,0)),0.0005) as val_stat_31466_feature_2 from dual;
    select sdo_geom.validate_geometry_with_context(MDSYS.SDO_GEOMETRY(3003,31462,null,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1,40,2003,1),
    MDSYS.SDO_ORDINATE_ARRAY(2568609.43,5653957,0,2568619.62,5653845.08,0,2568646.99,5653847.57,0,2568642.96,5653891.06,0,2568712.86,5653897.49,0,2568718.77,5653832.82,0,2568621.54,5653823.93,0,2568623.62,5653801.14,0,2568743.69,5653812.04,0,2568877.45,5653824.19,0,2568856.27,5654056,0,2568838.3,5654054.37,0,2568609.43,5653957,0,2568767.56,5654001.42,0,2568830.75,5654028.43,0,2568853.78,5654030.53,0,2568868.7,5653867.3,0,2568816.59,5653862.57,0,2568810.64,5653927.73,0,2568772.49,5653924.24,0,2568771.19,5653938.66,0,2568773.23,5653938.85,0,2568767.56,5654001.42,0)),0.0005) as val_stat_31462_feature_1 from dual;
    select sdo_geom.validate_geometry_with_context(MDSYS.SDO_GEOMETRY(3003,31462,null,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1,40,2003,1),
    MDSYS.SDO_ORDINATE_ARRAY(2568609.43,5653957,0,2568619.61,5653845.08,0,2568646.99,5653847.57,0,2568642.96,5653891.06,0,2568712.86,5653897.49,0,2568718.77,5653832.82,0,2568621.54,5653823.93,0,2568623.62,5653801.14,0,2568743.69,5653812.04,0,2568877.45,5653824.19,0,2568856.27,5654056,0,2568838.3,5654054.37,0,2568609.43,5653957,0,2568767.56,5654001.42,0,2568830.75,5654028.43,0,2568853.78,5654030.53,0,2568868.7,5653867.3,0,2568816.59,5653862.57,0,2568810.64,5653927.73,0,2568772.49,5653924.24,0,2568771.19,5653938.66,0,2568773.23,5653938.85,0,2568767.56,5654001.42,0)),0.0005) as val_stat_31462_feature_2 from dual;
    select sdo_geom.validate_geometry_with_context(MDSYS.SDO_GEOMETRY(3003,null,null,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1,40,2003,1),
    MDSYS.SDO_ORDINATE_ARRAY(2568609.43,5653957,0,2568619.62,5653845.08,0,2568646.99,5653847.57,0,2568642.96,5653891.06,0,2568712.86,5653897.49,0,2568718.77,5653832.82,0,2568621.54,5653823.93,0,2568623.62,5653801.14,0,2568743.69,5653812.04,0,2568877.45,5653824.19,0,2568856.27,5654056,0,2568838.3,5654054.37,0,2568609.43,5653957,0,2568767.56,5654001.42,0,2568830.75,5654028.43,0,2568853.78,5654030.53,0,2568868.7,5653867.3,0,2568816.59,5653862.57,0,2568810.64,5653927.73,0,2568772.49,5653924.24,0,2568771.19,5653938.66,0,2568773.23,5653938.85,0,2568767.56,5654001.42,0)),0.0005) as val_stat_null_feature_1 from dual;
    select sdo_geom.validate_geometry_with_context(MDSYS.SDO_GEOMETRY(3003,null,null,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1,40,2003,1),
    MDSYS.SDO_ORDINATE_ARRAY(2568609.43,5653957,0,2568619.61,5653845.08,0,2568646.99,5653847.57,0,2568642.96,5653891.06,0,2568712.86,5653897.49,0,2568718.77,5653832.82,0,2568621.54,5653823.93,0,2568623.62,5653801.14,0,2568743.69,5653812.04,0,2568877.45,5653824.19,0,2568856.27,5654056,0,2568838.3,5654054.37,0,2568609.43,5653957,0,2568767.56,5654001.42,0,2568830.75,5654028.43,0,2568853.78,5654030.53,0,2568868.7,5653867.3,0,2568816.59,5653862.57,0,2568810.64,5653927.73,0,2568772.49,5653924.24,0,2568771.19,5653938.66,0,2568773.23,5653938.85,0,2568767.56,5654001.42,0)),0.0005) as val_stat_null_feature_2 from dual;
    select sdo_geom.validate_geometry_with_context(SDO_CS.MAKE_2d(MDSYS.SDO_GEOMETRY(3003,31466,null,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1,40,2003,1),
    MDSYS.SDO_ORDINATE_ARRAY(2568609.43,5653957,0,2568619.62,5653845.08,0,2568646.99,5653847.57,0,2568642.96,5653891.06,0,2568712.86,5653897.49,0,2568718.77,5653832.82,0,2568621.54,5653823.93,0,2568623.62,5653801.14,0,2568743.69,5653812.04,0,2568877.45,5653824.19,0,2568856.27,5654056,0,2568838.3,5654054.37,0,2568609.43,5653957,0,2568767.56,5654001.42,0,2568830.75,5654028.43,0,2568853.78,5654030.53,0,2568868.7,5653867.3,0,2568816.59,5653862.57,0,2568810.64,5653927.73,0,2568772.49,5653924.24,0,2568771.19,5653938.66,0,2568773.23,5653938.85,0,2568767.56,5654001.42,0))),0.0005) as val_stat_31466_feature_1_2d from dual;
    select sdo_geom.validate_geometry_with_context(SDO_CS.MAKE_2d(MDSYS.SDO_GEOMETRY(3003,31466,null,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1,40,2003,1),
    MDSYS.SDO_ORDINATE_ARRAY(2568609.43,5653957,0,2568619.61,5653845.08,0,2568646.99,5653847.57,0,2568642.96,5653891.06,0,2568712.86,5653897.49,0,2568718.77,5653832.82,0,2568621.54,5653823.93,0,2568623.62,5653801.14,0,2568743.69,5653812.04,0,2568877.45,5653824.19,0,2568856.27,5654056,0,2568838.3,5654054.37,0,2568609.43,5653957,0,2568767.56,5654001.42,0,2568830.75,5654028.43,0,2568853.78,5654030.53,0,2568868.7,5653867.3,0,2568816.59,5653862.57,0,2568810.64,5653927.73,0,2568772.49,5653924.24,0,2568771.19,5653938.66,0,2568773.23,5653938.85,0,2568767.56,5654001.42,0))),0.0005) as val_stat_31466_feature_2_2d from dual;

  • Sdo_geom.validate_geometry_with_context

    I have been using sdo_geom.validate_geometry_with_context to identify problems with geometry. When reporting errors the function returns, if one exists, an error code and the position of the error.
    Does anyone know whether the validation stops at this point, i.e. it does not continue through the remainder of the geometry to find further errors?

    The function SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT will validate a single geometry. You can write a PL/SQL cursor to validate each geometry in a table if you desire.
    You can validate all the geometries in a table with SDO_GEOM.VALIDATE_LAYER_WITH_CONTEXT, and the results are written to a table.
    See the Oracle Spatial Users Guide and Reference, Release 9.2 for further information

  • SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT giving seemingly incorrect result

    I ran the following query and got the unexpected answer of TRUE:
    SELECT SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT
    SDO_UTIL.REMOVE_DUPLICATES
    SDO_GEOMETRY
    2002,
    8307,
    NULL,
    SDO_ELEM_INFO_ARRAY(1,2,1),
    SDO_ORDINATE_ARRAY(32.5, 65.789, 32.5, 65.789)
    ), .005
    ), .005
    FROM dual;
    What surprised me was the SDO_ORDINATE_ARRAY after the remove duplicates has only a longitude and latitude yet the geometry a line was validated as true. Doesn't a line at least need two sets of coordinates? How was this geometry validated to true?

    yet the geometry a line was validated as true.Actually a geometry line containing duplicates was converted to a point type (gtype 2001), which was validated as 'TRUE' as it should be.
    SQL> SELECT SDO_UTIL.REMOVE_DUPLICATE_VERTICES(SDO_GEOMETRY(2003, 8307,NULL,
    SDO_ELEM_INFO_ARRAY(1,1003,1),
    SDO_ORDINATE_ARRAY(32.5, 65.789, 32.5, 65.789)
    ),0.005)
    FROM DUAL;
    SDO_GEOMETRY(2001, 8307, NULL, SDO_ELEM_INFO_ARRAY(1, 1, 1), SDO_ORDINATE_ARRAY(32.5, 65.789))
    1 row selected.

  • Sdo_geom.validate_geometry_with_context - Reporting multiple errors

    All Oracle versions.
    sdo_geom.validate_geometry_with_context appears to report only the first error it finds in an sdo_geometry.
    Thus, it reports only the first duplicate vertex in "ORA-13356: adjacent points in a geometry are redundant", or only
    the first loop in a ring for "ORA-13349: polygon boundary crosses itself".
    I understand that, for some errors, reporting more than one error would be difficult but for more simple errors such as
    the two mentioned, it would be most helpful to have validate_geometry_with_context report more than one error location
    in its return string. Such reporting would reduce the time and effort required in find-fix-find error correction cycle.
    Comments?
    regards
    Simon

    A triangle is a bad example for ORA-13349. In fact, it is impossible for a triangle not to be right unless two points are the same.
    I don't agree with a lot of the comments because I know that many simple types of errors can be detected. Here is
    a polygon with a hole that has multiple 13349 errors because of "bow-ties" or "loops in the outer boundary".
    select sdo_geom.validate_geometry_with_context(MDSYS.SDO_GEOMETRY(2003, NULL, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1,17,2003,1),
                                      MDSYS.SDO_ORDINATE_ARRAY(
                                      523960.5, 5201847.7, 525174.7, 5202361.9, 525171.4, 5202328.8, 524843.0, 5202839.7,
                                      524889.4, 5202833.0, 523748.1, 5202484.7, 523781.3, 5202554.4, 523960.5, 5201847.7,
                                      524141.2, 5202192.9, 524223.1, 5202550.3, 524197.1, 5202520.5, 524502.3, 5202546.6,
                                      524584.2, 5202293.4, 524614.0, 5202345.6, 524171.0, 5202189.2, 524141.2, 5202192.9)),0.005) as error
              from dual;
    ERROR                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
    13349 [Element <1>] [Ring <1>][Edge <5>][Edge <7>] As you can see, validate_geometry_with_context() only returns the first loop in the outer boundary (1003).
    But with a slight modification of approach we can get at least one more:
    select sdo_geom.validate_geometry_with_context(b.geom,0.005) as error
    from (select mdsys.sdo_util.extract(
                    MDSYS.SDO_GEOMETRY(2003, NULL, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1,17,2003,1),
                                       MDSYS.SDO_ORDINATE_ARRAY(
                                       523960.5, 5201847.7, 525174.7, 5202361.9, 525171.4, 5202328.8, 524843.0, 5202839.7,
                                       524889.4, 5202833.0, 523748.1, 5202484.7, 523781.3, 5202554.4, 523960.5, 5201847.7,
                                       524141.2, 5202192.9, 524223.1, 5202550.3, 524197.1, 5202520.5, 524502.3, 5202546.6,
                                       524584.2, 5202293.4, 524614.0, 5202345.6, 524171.0, 5202189.2, 524141.2, 5202192.9)),1,a.elem_no) as geom
             from (select level as elem_no from dual connect by level < 3) a
          ) b;
    ERROR
    13349 [Element <1>] [Ring <1>][Edge <5>][Edge <7>]
    13349 [Element <1>] [Ring <1>][Edge <7>][Edge <5>]So, by extension, it is possible to return all the other bow-ties: I have done this in a function I have written. I now
    need to extend it to find all other bow-ties in a ring.
    I have function that finds all duplicate vertices (13356) in a geometry. Works well.
    select rownum as point, b.valid, c.geometry
      from (select substr(sdo_geom.validate_geometry_with_context(a.geom,0.005),1,40) as valid,
                   a.geom
              from (select MDSYS.SDO_GEOMETRY(2006, NULL, NULL,
                                      MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1,13,2,1),
                                      MDSYS.SDO_ORDINATE_ARRAY(50.0, 15.0, 55.0, 15.0, 55.0, 15.0, 55.0, 15.0, 60.0, 15.0, 60.0, 15.0, 65.0, 15.0)) as geom
                      from dual) a
            ) b,
            TABLE(sdo_error.getErrors(b.geom,0.005)) c;
    POINT VALID                                    GEOMETRY
    1     13356 [Element <1>] [Coordinate <2>] MDSYS.SDO_GEOMETRY(2001,NULL,MDSYS.SDO_POINT_TYPE(55,15,NULL),NULL,NULL)
    2     13356 [Element <1>] [Coordinate <2>] MDSYS.SDO_GEOMETRY(2001,NULL,MDSYS.SDO_POINT_TYPE(55,15,NULL),NULL,NULL)
    3     13356 [Element <1>] [Coordinate <2>] MDSYS.SDO_GEOMETRY(2001,NULL,MDSYS.SDO_POINT_TYPE(60,15,NULL),NULL,NULL)As I said, this can be done for simple elemental errors. Errors that involve interactions of rings for example are harder. But, gee, other
    software packages provide such capability so it is possible. And, these are data-level issues so I think it reasonable that Oracle
    provides an improved set of functions and not hand it over to external GIS software clients.
    regards
    Simon

  • SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT returns ORA-13199 SRID does not exist

    Hi everyone,
    I'm facing with this error while I was trying to list wrong spatial data (11.0.2.0.3 RAC (AIX))
    Select   *
    From     table
    Where    SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT (GEOMETRY,0.001)! ='TRUE'
    It returns :
    ORA-13199: SRID does not exists
    ORA-06512: at "MDSYS.MD", line 1723
    ORA-06512: at "MDSYS.MDERR", line 17
    ORA-06512: at "MDSYS.SDO_CS", line 5328
    ORA-06512: at "MDSYS.SDO_GEOM", line 483
    ORA-06512: at "MDSYS.SDO_GEOM", line 560
    ORA-06512: at line 1
    Is there anyone who faced with this kind of issue or any idea ?
    Thanks in advance
    Regards

    There is no such SRID 2000303. However, this one sure looks like it does the same thing. Replace all the SRID values with 2320 and you should be set.
    SQL> select *
      2  from MDSYS.SDO_COORD_REF_SYSTEM
      3  where srid = 2320;
          SRID COORD_REF_SYS_NAME                                                              COORD_REF_SYS_KIND
    COORD_SYS_ID  DATUM_ID GEOG_CRS_DATUM_ID SOURCE_GEOG_SRID PROJECTION_CONV_ID CMPD_HORIZ_SRID CMPD_VERT_SRID
    INFORMATION_SOURCE
    DATA_SOURCE                              IS_LE LEGACY_CODE
    LEGACY_WKTEXT
    LEGACY_CS_BOUNDS(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
    IS_VA SUPPO
          2320 ED50 / TM30                                                                      PROJECTED
            4530                        6230            4230              16370
    General Command of Mapping via EuroGeographics; http://crs.ifag.de/
    EPSG                                    FALSE
    TRUE  TRUE

  • SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT for polygon geometry validation

    Hi,
    I would like to make a validation of the polygon geometry upon a table SCHEMA.TABLE with the GEOM field, where the geometry is stored.
    Can someone help me with a sample SQL sentence to fill my SCHEMA.VALIDITY table with all the detected errors that occured in the SCHEMA.TABLE?
    Thanks!
    Dejan

    Greg
    Have you tried scrolling down to the bottom of that section? You will see the following example (as in all descriptions in the documentation):
    Examples*
    The following example validates the geometry objects stored in the SHAPE column of the COLA_MARKETS table. The example includes the creation of the result table. For this example, a deliberately invalid geometry was inserted into the table before the validation was performed.
    -- Is a layer valid? (First, create the result table.)
    CREATE TABLE val_results (sdo_rowid ROWID, result varchar2(1000));
    -- (Next statement must be on one command line.)
    CALL SDO_GEOM.VALIDATE_LAYER_WITH_CONTEXT('COLA_MARKETS','SHAPE','VAL_RESULTS');
    Call completed.
    SQL> SELECT * from val_results;
    SDO_ROWID
    RESULT
    Rows Processed <12>
    AAABXNAABAAAKYAAC+
    +13349 [Element <1>] [Ring <1>][Edge <1>][Edge <3>]+
    CREATE TABLE val_results (sdo_rowid ROWID, result varchar2(1000));
    would have been in your case:
    CREATE TABLE schema.validity (sdo_rowid ROWID, result varchar2(1000));
    CALL SDO_GEOM.VALIDATE_LAYER_WITH_CONTEXT('COLA_MARKETS','SHAPE','VAL_RESULTS');
    would have been in your case:
    CALL SDO_GEOM.VALIDATE_LAYER_WITH_CONTEXT('SCHEMA.TABLE','GEOM','SCHEMA.VALIDITY');
    SQL> SELECT * from val_results;
    would have been in your case:
    SELECT * from schema.validity;
    If you would like to have your id included:
    Select a.id, b.*
    from schema.validity b left outer join schema.table a
    on (b.sdo_rowid= a.rowid);
    In order to help people making their life easier with the management of spatial metadata, spatial index and geometry validation, like yours, and possible fix up, 1Spatial has a product named Radius Check.
    Have a look at the second item from the top here: http://www.oracle.com/technology/products/spatial/htdocs/spatial_partners_downloads.html
    or
    http://www.1spatial.com/products/radius_check/index.php
    Maybe you can find it usefull.
    Luc

  • Get all vertices from a geometry of multiple polygons

    I tried to use sdo_util.GetVertices to retrieve all the vertices from a geometry column. Some of the geometries of gType 2007 that contains more than one element. The getVertices function seems to give back the vertices of the first element only. How can I get all the vertices then?
    Edited by: 937152 on May 29, 2012 11:56 AM

    Why do you have all the NULLs in your sdo_elem_info_array and sdo_ordinate_array? This is very very wrong - see http://docs.oracle.com/cd/E11882_01/server.112/e17766/e12700.htm#sthref3897
    Despite that I am able to get all the "vertices" back from your sample geometry - note that I changed your SELECT statement a little.
    jot_test@JOHNOT> create table assessment_parcel_merged (
      2  id number,
      3  geometry sdo_geometry);
    Table created.
    jot_test@JOHNOT>
    jot_test@JOHNOT> insert into assessment_parcel_merged
      2  (id, geometry)
      3  values
      4  (506833,
      5  mdsys.sdo_geometry(2007,82232,null,
      6  mdsys.sdo_elem_info_array(1,1003,1,13,1003,1,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null),
      7  mdsys.sdo_ordinate_array(632941.3695,5536245.0144,632939.95209944,5536241.97593627,633251.020958124,5536096.38289373,633369.443364573,5536040.95632826,633371.0274,5536043.9168,632941.3695,5536245.0144,631892.0616,5536736.1337,631892.8842984,5536702.62493823,632873.47478553,5536243.66593412,632884.740084103,5536267.81696815,632886.1576,5536270.8559,631892.0616,5536736.1337,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null)));
    1 row created.
    jot_test@JOHNOT>
    jot_test@JOHNOT> select sdo_geom.validate_geometry_with_context(geometry, 0.0005) as geom_validate
      2  from assessment_parcel_merged;
    GEOM_VALIDATE
    13033
    1 row selected.
    jot_test@JOHNOT>
    jot_test@JOHNOT> set null null
    jot_test@JOHNOT> select o.x, o.y
      2  from assessment_parcel_merged a, table(sdo_util.getvertices(a.geometry)) o
      3  where a.id = 506833;
             X          Y
    632941.37 5536245.01
    632939.952 5536241.98
    633251.021 5536096.38
    633369.443 5536040.96
    633371.027 5536043.92
    632941.37 5536245.01
    631892.062 5536736.13
    631892.884 5536702.62
    632873.475 5536243.67
    632884.74 5536267.82
    632886.158 5536270.86
    631892.062 5536736.13
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    50 rows selected.John

  • Error while inserting spatial data

    Hi All,
    I have a problem while inserting spatial data. could some one please help me in solving this.
    I have creatd a table with spatial index.
    INSERT INTO USER_SDO_GEOM_METADATA
                VALUES('SDO_CA_test', 'CA', SDO_DIM_ARRAY(
                    MDSYS.SDO_DIM_ELEMENT ('LON', 71.19545, 120.35101, 0.000005),
                    MDSYS.SDO_DIM_ELEMENT ('LAT', 12.1145, 26.58041, 0.000005)), 8687);
         CREATE INDEX IO_CA_test ON SDO_CAR_test(CA)
        INDEXTYPE IS MDSYS.SPATIAL_INDEX PARAMETERS ('SDO_COMMIT_INTERVAL=10000 SDO_RTR_PCTFREE = 0');when I insert data from another spatail table that does not have a index I get an error.
    insert into sdo_ca_test as select * from base_sdo;
    ORA-29875 Failed in the ececution of the ODCINDEXINSERT routine
    ORA-13354 incorrect offset in ELEM_INFO_ARRAY
    ORA_06512 at MDSYS.SDO_INDEX_METHOD_101 line. 709I believe that there is some incorrect data that is not with my index defination.
    How do I check this invalid data at base_sdo table. The base_sdo table has no index.
    rgds
    Saz
    Edited by: Saaz Ena on Dec 21, 2009 6:16 PM

    Can you try SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT
    or SDO_GEOM.VALIDATE_LAYER_WITH_CONTEXT? e.g.
    select * from base_sdo a where
    SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(a.CA, 0.000005) != 'TRUE';

Maybe you are looking for

  • Pictures folder does not have all events in it.

    I import my photos using iPhoto 11 as I use Aperture 3 and/or LR4 to edit events and/or photos. However I am unable to import newer events from the Pictures folder option that Aperture and LR4 gives one to import as all my newer events of the past 12

  • WAN encryption in cisco 805

    Hi, I need to configure WAN encrption between the two Cisco 805 routers. Appreciate if you can help me in configuring.I am new to routers. The items choose are as below: Description Qty Cisco 805 Serial Router 2 Cisco 805 Series IOS IP/FW PLUS IPSEC

  • B1WS: B1 Web Services wrapper

    1) Does that mean the partners and/or customers need to buy the DI Server as well or Just the SAP Business One licenses? B1WS is built on DI Server. You need a DI Server license to use B1WS. 2) Has anyone out there :>) managed to get it working withi

  • How to install a second drive?

    I just received my Media Hub that has a 1 TB drive.  I also ordered a 2nd 1 TB drive which will arrive tomorrow.  Is it best to perform the initial installation with the 2nd new drive installed?   Or is it best to do the intitial setup without the ne

  • CRS with out RAC

    Hello, We are using CRS in our company to manage automatic fail over of single instance databases as suggested by one of our consulting companies. Since our applications can not benefit from RAC we decided we will use single instance 10G database run