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

Similar Messages

  • 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.

  • 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 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

  • Error on SDO_GEOM.RELATE

    I get this error on this statement:
    if SDO_GEOM.RELATE(Pic1,'anyinteract',Pic2,0.0000005)='TRUE'
    then
    The error i get is the following:
    ORA-13050: unable to construct spatial object
    ORA-06512: at MDSYS.SDO_3GL
    ORA-06512: at MDSYS.MD2
    Where can i do?

    The most likely cause is that an instance of Pic1 or Pic2 is invalid. Run sdo_geom.validate_geometry_with_context() and if any geometries are invalid, fix or delte them.
    Jayant

  • Something wrong with sdo_geom.sdo_intersection function

    I have two geometries. Both of them are valid in all tolerances, I tested.
    The relation between geometries is OVERLAPBDYINTERSECT.
    I run the sdo_geom.sdo_intersection with parameters - both of geometries and as result there is geometry which relation with second geom is again OVERLAPBDYINTERSECT.
    IMHO, the relation MUST be COVEREDBY.
    The error occurs rarely, but this is a real problem.
    The OS is Windows 2003 Enterprise Edition x64, sp1.
    Oracle version - Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64
    The result is same on OS is Windows 2003 Enterprise Edition x32, sp1.
    Oracle version - Oracle Database 10g Enterprise Edition Release 10.2.0.3.0
    There are the test cases:
    declare
    -- Local variables here
    v_intersected_geom1 sdo_geometry;
    v_first_geom1 sdo_geometry :=sdo_geometry('POLYGON ((456705.802734375 4706456.71875, 456815.033203125 4706511.4609375, 456784.951171875 4706569.671875, 456766.470703125 4706605.4296875, 456652.1015625 4706543.96875, 456664.111328125 4706523.5390625, 456679.171875 4706497.9140625, 456694.052734375 4706474.890625, 456705.802734375 4706456.71875))');
    v_second_geom1 sdo_geometry := sdo_geometry('POLYGON ((456245.65625 4706998.046875, 456273.796875 4706951.828125, 456298.703125 4706912.40625, 456341.09375 4706834.34375, 456362.28125 4706798.6875, 456447.515625 4706735.1953125, 456499.71875 4706698.34375, 456536.25 4706675.9375, 456603.0625 4706627.390625, 456679.171875 4706497.9140625, 456720.734375 4706433.609375, 456802.703125 4706363.203125, 456872.8125 4706316.46875, 456872.812411145 4706316.46870013, 456874.3125 4706315.46875, 456938.609375 4706269.6796875, 456979.03125 4706252.6328125, 457040.90625 4706235.09375, 457094.96875 4706224.3828125, 457175.828125 4706210.25, 457187.515625 4706210.328125, 457084.203125 4706414.15625, 457020.484375 4706546.875, 456914.671875 4706736.953125, 456815.09375 4706934.890625, 456773.9375 4707020.15625, 456665.5625 4707219.046875, 456550.65625 4707437.0625, 456544.78125 4707434.0078125, 456517.625 4707412.953125, 456501.4375 4707406.296875, 456484.046875 4707396.734375, 456471.0625 4707386.125, 456443.921875 4707368.21875, 456449.84375 4707359.015625, 456461.6875 4707337.078125, 456467.15625 4707323.265625, 456466.28125 4707310.328125, 456462.125 4707284.234375, 456456.203125 4707259.234375, 456454.4375 4707242.796875, 456461.6875 4707231.609375, 456457.875 4707224.953125, 456450.9375 4707221.5234375, 456444.734375 4707222.5625, 456397.875 4707194.328125, 456380.109375 4707179.640625, 456363.875 4707170.4296875, 456349.84375 4707184.90625, 456334.0625 4707202.4453125, 456309.109375 4707228.8125, 456294.265625 4707214.484375, 456295.96875 4707210.046875, 456372.375 4707063.109375, 456245.65625 4706998.046875))');
    v_res1 varchar2(100);
    v_intersected_geom2 sdo_geometry;
    v_first_geom2 sdo_geometry :=sdo_geometry('POLYGON ((437834.87109375 4685964.8984375, 437757.328125 4686011.734375, 437395.171875 4686241.375, 437293.296875 4686183.328125, 437276.984375 4686175.171875, 437228.65625 4686153.8359375, 437209.84375 4686150.6953125, 437185.984375 4686143.1640625, 437160.890625 4686117.4375, 437109.484375 4686029.53125, 437109.70703125 4686027.5234375, 437698.0 4685671.2109375, 437757.140625 4685785.015625, 437776.4375 4685842.4609375, 437786.1875 4685872.2109375, 437834.5 4685964.46875, 437834.87109375 4685964.8984375))');
    v_second_geom2 sdo_geometry := sdo_geometry('POLYGON ((437089.34375 4685943.6328125, 437090.40625 4685924.5390625, 437114.5625 4685850.9453125, 437144.734375 4685794.375, 437163.5 4685769.078125, 437191.796875 4685695.484375, 437246.953125 4685609.578125, 437325.4375 4685520.484375, 437391.1875 4685468.5234375, 437446.34375 4685437.765625, 437482.390625 4685414.4296875, 437516.34375 4685400.640625, 437539.671875 4685425.0390625, 437583.15625 4685510.9453125, 437601.96875 4685549.609375, 437623.0625 4685579.1328125, 437658.828125 4685614.28125, 437698.984375 4685672.640625, 437757.140625 4685785.015625, 437776.4375 4685842.4609375, 437786.1875 4685872.2109375, 437830.093807139 4685956.05466017, 437830.09375 4685956.0546875, 437834.5 4685964.46875, 437856.499141809 4685990.32412997, 437860.41015625 4685994.921875, 437861.64453125 4685996.375, 437878.890625 4686016.640625, 437951.319879907 4686091.80320543, 438008.546875 4686163.515625, 438035.4375 4686207.25, 438079.984375 4686266.640625, 438118.171875 4686320.734375, 438112.94140625 4686396.953125, 438112.859375 4686398.15625, 438177.5625 4686386.4921875, 438199.0625 4686563.15625, 438229.359375 4686675.2421875, 438283.875 4686799.4375, 438329.328125 4686914.5546875, 438425.640625 4687159.15625, 438568.5 4687514.921875, 438362.046875 4687576.421875, 438350.75 4687573.9140625, 438335.6875 4687563.875, 438314.34375 4687545.046875, 438280.46875 4687507.3984375, 438254.109375 4687465.9765625, 438198.3125 4687361.84375, 438106.046875 4687199.5859375, 437995.75 4686991.71875, 437942.015625 4686865.4921875, 437899.265625 4686742.78125, 437860.671875 4686658.6875, 437798.625 4686552.5234375, 437781.375 4686534.390625, 437758.203125 4686509.765625, 437727.796875 4686490.9375, 437680.96875 4686473.078125, 437628.84375 4686441.21875, 437572.84375 4686401.15625, 437528.09375 4686360.328125, 437487.84375 4686309.46875, 437469.015625 4686287.5, 437434.5 4686259.265625, 437401.234375 4686244.828125, 437293.296875 4686183.328125, 437276.984375 4686175.171875, 437228.65625 4686153.8359375, 437209.84375 4686150.6953125, 437185.984375 4686143.1640625, 437160.890625 4686117.4375, 437109.484375 4686029.53125, 437111.609375 4686010.4453125, 437112.671875 4685977.5703125, 437089.34375 4685943.6328125))');
    v_res2 varchar2(100);
    v_intersected_geom3 sdo_geometry;
    v_first_geom3 sdo_geometry :=sdo_geometry('POLYGON ((380746.4921875 4812010.8125, 380745.453125 4812010.15625, 380731.046875 4812004.390625, 380704.3125 4811969.015625, 380689.5 4811938.984375, 380627.7890625 4811828.3125, 380619.5625 4811772.765625, 380601.453125 4811679.375, 380519.171875 4811598.328125, 380481.734375 4811553.078125, 380473.5078125 4811521.40625, 380461.1640625 4811493.015625, 380435.25 4811459.28125, 380426.1953125 4811409.90625, 380419.203125 4811386.453125, 380422.4921875 4811337.90625, 380423.3125 4811268.796875, 380406.859375 4811214.90625, 380366.5390625 4811191.859375, 380341.859375 4811169.640625, 380333.6328125 4811146.203125, 380334.0390625 4811119.046875, 380339.7890625 4811100.3125, 380343.40625 4811074.109375, 380022.5390625 4811146.40625, 380007.171875 4811158.15625, 379984.578125 4811168.109375, 379971.015625 4811162.6875, 379931.25 4811037.046875, 379930.34375 4811010.828125, 380144.5625 4810962.03125, 380344.3125 4810909.609375, 380361.9609375 4810934.65625, 380403.734375 4810919.796875, 380518.9296875 4810889.40625, 380606.59375 4810862.1875, 380659.4375 4811048.90625, 380775.8984375 4811011.5625, 380790.453125 4811012.203125, 380800.5859375 4811016.0, 380834.7578125 4811122.328125, 380929.703125 4811091.3125, 380942.359375 4811098.90625, 380988.875 4811137.203125, 381023.6875 4811181.1875, 381069.890625 4811264.421875, 381079.0703125 4811292.265625, 381113.25 4811357.140625, 381139.828125 4811404.296875, 381146.796875 4811437.203125, 381153.4375 4811521.703125, 381158.1875 4811581.828125, 381153.125 4811632.15625, 381144.890625 4811661.265625, 381144.265625 4811717.59375, 381157.31640625 4811765.1875, 380746.4921875 4812010.8125))');
    v_second_geom3 sdo_geometry := sdo_geometry('POLYGON ((379931.25 4811037.046875, 379930.34375 4811010.828125, 380144.5625 4810962.03125, 380344.3125 4810909.609375, 380361.9609375 4810934.65625, 380403.734375 4810919.796875, 380518.9296875 4810889.40625, 380606.59375 4810862.1875, 380659.4375 4811048.90625, 380775.8984375 4811011.5625, 380790.453125 4811012.203125, 380800.5859375 4811016.0, 380834.7578125 4811122.328125, 380929.703125 4811091.3125, 380942.359375 4811098.90625, 380988.875 4811137.203125, 381023.6875 4811181.1875, 381069.890625 4811264.421875, 381079.0703125 4811292.265625, 381113.25 4811357.140625, 381139.828125 4811404.296875, 381146.796875 4811437.203125, 381153.4375 4811521.703125, 381158.1875 4811581.828125, 381153.125 4811632.15625, 381144.890625 4811661.265625, 381144.265625 4811717.59375, 381160.40625 4811776.453125, 381167.046875 4811810.3125, 381195.84375 4811893.859375, 381206.921875 4811928.046875, 381213.5703125 4811962.21875, 381221.4765625 4811988.484375, 381230.65625 4812014.75, 381260.40625 4812093.234375, 381268.8828125 4812145.390625, 381257.1328125 4812260.546875, 381194.859375 4812326.34375, 381033.953125 4812243.65625, 381033.950224401 4812243.65968153, 380986.234375 4812219.140625, 380816.3046875 4812090.78125, 380762.9765625 4812021.1875, 380745.453125 4812010.15625, 380731.046875 4812004.390625, 380704.3125 4811969.015625, 380689.5 4811938.984375, 380627.7890625 4811828.3125, 380619.5625 4811772.765625, 380601.453125 4811679.375, 380519.171875 4811598.328125, 380481.734375 4811553.078125, 380473.5078125 4811521.40625, 380461.1640625 4811493.015625, 380451.585874521 4811480.54694375, 380451.5859375 4811480.546875, 380435.25 4811459.28125, 380426.1953125 4811409.90625, 380419.203125 4811386.453125, 380422.4921875 4811337.90625, 380423.3125 4811268.796875, 380406.859375 4811214.90625, 380366.5390625 4811191.859375, 380341.859375 4811169.640625, 380333.6328125 4811146.203125, 380334.0390625 4811119.046875, 380339.7890625 4811100.3125, 380343.40625 4811074.109375, 380183.125 4811110.21875, 380183.118081404 4811110.22504572, 380022.5390625 4811146.40625, 380007.171875 4811158.15625, 379984.578125 4811168.109375, 379971.015625 4811162.6875, 379931.25 4811037.046875))');
    v_res3 varchar2(100);
    begin
    -- Test statements here
    dbms_output.put_line(' Test case 1');
    dbms_output.put_line(' -----------');
    dbms_output.put_line( 'validate v_first_geom1 - ' || sdo_geom.validate_geometry_with_context(v_first_geom1,0.00005));
    dbms_output.put_line( 'validate v_second_geom1 - ' ||sdo_geom.validate_geometry_with_context(v_second_geom1,0.00005));
    v_res1 := sdo_geom.relate(v_first_geom1,'DETERMINE', v_second_geom1, 0.00005);
    dbms_output.put_line('determine between v_first_geom1 and v_second_geom1 is ' ||v_res1);
    v_intersected_geom1 := sdo_geom.sdo_intersection(v_first_geom1, v_second_geom1, 0.00005);
    -- dbms_output.put_line('intersection geometry - '||sdo_util.to_wktgeometry(v_intersected_geom1));
    dbms_output.put_line( 'validate v_intersected_geom1 -' || sdo_geom.validate_geometry_with_context(v_intersected_geom1,0.00005));
    v_res1 := sdo_geom.relate(v_intersected_geom1,'DETERMINE', v_second_geom1, 0.00005);
    dbms_output.put_line('determine between v_intersected_geom1 and v_second_geom1 is ' ||v_res1);
    dbms_output.put_line(' ');
    dbms_output.put_line(' Test case 2');
    dbms_output.put_line(' -----------');
    dbms_output.put_line( 'validate v_first_geom2 - ' || sdo_geom.validate_geometry_with_context(v_first_geom2,0.00005));
    dbms_output.put_line( 'validate v_second_geom2 - ' ||sdo_geom.validate_geometry_with_context(v_second_geom2,0.00005));
    v_res2 := sdo_geom.relate(v_first_geom2,'DETERMINE', v_second_geom2, 0.00005);
    dbms_output.put_line('determine between v_first_geom2 and v_second_geom2 is ' ||v_res2);
    v_intersected_geom2 := sdo_geom.sdo_intersection(v_first_geom2, v_second_geom2, 0.00005);
    -- dbms_output.put_line('intersection geometry - '||sdo_util.to_wktgeometry(v_intersected_geom2));
    dbms_output.put_line( 'validate v_intersected_geom2 -' || sdo_geom.validate_geometry_with_context(v_intersected_geom2,0.00005));
    v_res2 := sdo_geom.relate(v_intersected_geom2,'DETERMINE', v_second_geom2, 0.00005);
    dbms_output.put_line('determine between v_intersected_geom2 and v_second_geom2 is ' ||v_res2);
    dbms_output.put_line(' ');
    dbms_output.put_line(' Test case 3');
    dbms_output.put_line(' -----------');
    dbms_output.put_line( 'v_first_geom3 - ' || sdo_geom.validate_geometry_with_context(v_first_geom3,0.00005));
    dbms_output.put_line( 'v_second_geom3 - ' ||sdo_geom.validate_geometry_with_context(v_second_geom3,0.00005));
    v_res3 := sdo_geom.relate(v_first_geom3,'DETERMINE', v_second_geom3, 0.00005);
    dbms_output.put_line('determine between v_first_geom3 and v_second_geom3 is ' ||v_res3);
    v_intersected_geom3 := sdo_geom.sdo_intersection(v_first_geom3, v_second_geom3, 0.00005);
    -- dbms_output.put_line('intersection geometry - '||sdo_util.to_wktgeometry(v_intersected_geom3));
    dbms_output.put_line( 'v_intersected_geom3 -' || sdo_geom.validate_geometry_with_context(v_intersected_geom3,0.00005));
    v_res3 := sdo_geom.relate(v_intersected_geom3,'DETERMINE', v_second_geom3, 0.00005);
    dbms_output.put_line('determine between v_intersected_geom3 and v_second_geom3 is ' ||v_res3);
    dbms_output.put_line(' ');
    end;
    The result is:
    Test case 1
    validate v_first_geom1 - TRUE
    validate v_second_geom1 - TRUE
    determine between v_first_geom1 and v_second_geom1 is OVERLAPBDYINTERSECT
    validate v_intersected_geom1 -TRUE
    determine between v_intersected_geom1 and v_second_geom1 is OVERLAPBDYINTERSECT
    Test case 2
    validate v_first_geom2 - TRUE
    validate v_second_geom2 - TRUE
    determine between v_first_geom2 and v_second_geom2 is OVERLAPBDYINTERSECT
    validate v_intersected_geom2 -TRUE
    determine between v_intersected_geom2 and v_second_geom2 is OVERLAPBDYINTERSECT
    Test case 3
    v_first_geom3 - TRUE
    v_second_geom3 - TRUE
    determine between v_first_geom3 and v_second_geom3 is OVERLAPBDYINTERSECT
    v_intersected_geom3 -TRUE
    determine between v_intersected_geom3 and v_second_geom3 is OVERLAPBDYINTERSECT
    Any ideas?
    Message was edited by:
    petiozaf

    Hi,
    This is definitely a precision issue and due to the numerical stability problem
    very slight differences in coordinates is resulting in OVERLAPBDYINTERSECT
    instead of COVERS.
    Since you have many digits after the decimal in the input data, the tolerance you are
    specifying may not work for all pairs of geometries.
    For example, lets say you have vertices from geometry A as a1, ... aN and vertices
    from B as b1 ... bN.
    When each geometry is validated at a given tolerance there is no problem.
    But when you put two geometries together, the tolerance you specify many be
    valid for the combination of those two.
    For example, when these two geometries share an edge, the vertices might not
    align exactly.
    So you will have line segments which are made up of vertices from both geometries
    like: a1 b3 a2 b4 ...
    In such cases, the distance between a1 and b3 might be less than the tolerance you
    specified so we have to internally adjust the tolerance.
    As a result, the intersection might have been computed at a lesser tolerance than the
    one you specified (i.e. 0.00005 could be changed to 0.000005).
    So when you try to do RELATE again with 0.00005, the result is slightly off due
    to the tolerance difference.
    The best option in this case is to look for some slightly relaxed constraint than to check
    for the exact COVEREDBY/COVERS relationship with the intersection geometry.
    There are other factors such as lost precision (very minor) due to conversion from floating point double to oracle NUMBER and vice versa which may change a COVERS
    to OVERLAPBDYINTERSECT since you have many digits after decimal
    in the input data.
    siva

  • Simple geometry gets ORA-29532 error on all SDO_GEOM calls

    Hi all,
    I have a single point in a table such that the query:
    select SDO_GEOM.VALIDATE_GEOMETRY(geomObj, 0.05) from testvalid;
    /* Returns */
    SDO_GEOM.VALIDATE_GEOMETRY(GEOMOBJ,0.05)
    'TRUE'However the query:
    select SDO_GEOM.VALIDATE_GEOMETRY_with_context(geomObj, 0.05) from testvalid;Receives the following error:
    ORA-29532: Java call terminated by uncaught Java exception: java.lang.NumberFormatException: empty String
    ORA-06512: at "MDSYS.SDO_3GL", line 658
    ORA-06512: at "MDSYS.SDO_GEOM", line 519
    ORA-06512: at "MDSYS.SDO_GEOM", line 558
    ORA-06512: at line 1The data itself is a single sdo_point:
    select GEOMOBJ from testvalid;
    /* Returns: */
    GEOMOBJ
    '(3001, , (174.092329032787, 129.420551704918, -71.2857142857142), , )'I think that the problem is something to do with the precision of the stored X, Y and Z values in the point because if I run the following:
    update TESTVALID set GEOMOBJ.sdo_point.x = cast(GEOMOBJ.sdo_point.x as number(8,3));
    select SDO_GEOM.VALIDATE_GEOMETRY_with_context(geomObj, 0.05) from testvalid;
    /* Returns: */
    SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(GEOMOBJ,0.05)
    'TRUE'Similarly, running a direct comparison from an object made on the fly from the point's text representation works fine:
    select SDO_GEOM.VALIDATE_GEOMETRY_with_context("MDSYS"."SDO_GEOMETRY"(3001,NULL, "MDSYS"."SDO_POINT_TYPE"(174.092329032787,129.420551704918,-71.2857142857142),NULL,NULL), 0.005) from dual;
    /* Returns */
    SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT("MDSYS"."SDO_GEOMETRY"(3001,NULL,"MDSYS"."SDO_POINT_TYPE"(174.092329032787,129.420551704918,-71.2857142857142),NULL,NULL),0.005)
    'TRUE'Note that I only noticed this problem after upgrading from v11 to v11 R2. Also, the same ORA-29532 error comes up when running any of the SDO_GEOM.[x] function calls such as SDO_GEOM.DISTANCE(). The problem is not limited to SDO_POINT type geometries, yet the problem occurs only on some geometry entries in my database. It is repeatable in that the same geometry will continue to fail and the only solution I've found is to try to round down its precision in x, y, and/or z. I only know how to easily round down the precision for SDO_POINT types, so one of my problems is that I'm left with a whole scattering of other geometries that I can no longer spatially query.
    The datas themselves were inserted from MATLAB (which connects using v11 Oracle ODBC Java drivers) which converts my coordinates to java.math.BigDecimal and binds them to an oracle prepared statement.
    One possibility that I'm considering is that the insertion is done from various computers, some of which are 64-bit machines. Maybe somehow those machines are pumping in coordinates to a precision too great for oracle geometry?
    Any help would be fantastic as I'm pretty lost here.
    If the precision is indeed the problem, does anyone know how I can trim off those excess values after the decimal point for all geometry types?
    Thanks,
    Sven.

    The problem is with the way the ordiantes are created via java programs pre 11.2.
    There was a bit alignment problem in the internal representation of the number when these numbers are created from a java program.
    In 11.2 this corruption is fixed, but as a result the data that is already corrupted gives this "empty string" error.
    It is very easy to fix. Follow the steps in the script below.
    create or replace function id_geom ( g in sdo_geometry)
    return sdo_geometry deterministic as
    g1 sdo_geometry ;
    idx number;
    ords sdo_ordinate_array;
    x number;
    y number;
    z number;
    point_t sdo_point_type;
    begin
    if (g.sdo_point is not NULL) then
    x := NULL; y := NULL; z := NULL;
    if (g.sdo_point.x is not NULL) then
    x := g.sdo_point.x * 10;
    x := x / 10;
    end if;
    if (g.sdo_point.y is not NULL) then
    y := g.sdo_point.y * 10;
    y := y / 10;
    end if;
    if (g.sdo_point.z is not NULL) then
    z := g.sdo_point.z * 10;
    z := z / 10;
    end if;
    point_t := SDO_POINT_TYPE(x,y,z);
    else
    point_t := NULL;
    end if;
    if (g.sdo_ordinates is not NULL) then
    ords := sdo_ordinate_array();
    ords.extend(g.sdo_ordinates.count);
    for idx in 1 .. ords.count loop
    x := g.sdo_ordinates(idx);
    x := (x*10.0);
    x := x/10.0;
    ords(idx) := x;
    end loop;
    g1 := sdo_geometry(g.sdo_gtype, g.sdo_srid,point_t,g.sdo_elem_info,ords);
    else
    g1 := sdo_geometry(g.sdo_gtype, g.sdo_srid,point_t,g.sdo_elem_info, NULL);
    end if;
    return g1;
    end;
    And then update the rows with geometry data with SQL like this:
    update geom_table set geom = id_geom(geom);

  • SDO_AGGR_SET_UNION fails but SDO_GEOM.SDO_UNION succeeds.

    Hi folks,
    Happy Thanksgivings all. I have an aggregation task that seemed ideal to try out the new SDO_AGGR_SET_UNION function in 11gR2 (11.2.0.2). I have two valid touching polygons (amongst many others) that validate at 0.05 meter tolerance. When I union them together using SDO_GEOM.SDO_UNION or the original SDO_AGGR_UNION the results look great and the area of the new polygon is close to the two inputs. However when I run the exact same polygons through SDO_AGGR_SET_UNION I get back failed results - e.g. a 2004 containing one input polygon and a random point geometry from the boundary of the other polygon.
    Aggregation errors like this aren't exactly anything unheard of in Oracle Spatial and normally I'd just submit it as a bug. But I am a bit confused when the usual SDO_UNION functions works just fine but the new SDO_AGGR_SET_UNION function fails. Aren't they working off the same codebase? I've always assumed that what works for SDO_UNION would work for SDO_AGGR_UNION and now SDO_AGGR_SET_UNION is just another addition to the family of "unioners". Do we need to treat (and test) the new SDO_AGGR_SET_UNION as a different critter altogether from SDO_UNION? My apologies if that drifts into proprietary taboo land. Looking at the results of my test again I see that in fact SDO_AGGR_UNION does not EXACTLY match SDO_UNION (darn close though) so perhaps the family idea is all wrong?
    My opinion at this point is confused about whether to use SDO_AGGR_SET_UNION. It is much faster and much easier on the PGA I'l will admit, but SDO_UNION wins the quality award for this task.
    Cheers and Happy Holidays,
    Paul
    DECLARE
       polygon1                  SDO_GEOMETRY;
       polygon2                  SDO_GEOMETRY;
       rez_oldschool_sdo_union   SDO_GEOMETRY;
       rez_aggr_set_union        SDO_GEOMETRY;
       rez_aggr_union            SDO_GEOMETRY;
       num_tolerance             NUMBER := 0.05;
    BEGIN
       polygon1 :=
          SDO_GEOMETRY(2003, 8265, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1),
          SDO_ORDINATE_ARRAY(-101.367659850094, 45.6250958279126, -101.367750579539, 45.6246663149791, -101.36778407735, 45.6239928420968, -101.367540353957, 45.6233468469559, -101.367308521691, 45.6229827221804, -101.366899484815, 45.6228175577095, -101.366673138039, 45.6225835498738, -101.366629328625, 45.6222646352215, -101.366628551902, 45.6222589429779, -101.366095924796, 45.6220963415067, -101.365627851382, 45.6219975468078, -101.364973450124, 45.6218808707156, -101.364448124586, 45.6218917783656, -101.364110017238, 45.6219421740928, -101.363654697356, 45.6221469160479, -101.363214785275, 45.6219824072281, -101.362436795648, 45.6218682941355, -101.361686971078, 45.6216884967243, -101.360873514825, 45.6214665886314, -101.359874660186, 45.6212484952359, -101.358967626503, 45.6210068282033, -101.358182365109, 45.6207192059896, -101.358076000621, 45.6203958805935, -101.3577215616, 45.6200559553039, -101.357368016649, 45.619737726105, -101.357067192006, 45.6199392494093, -101.356612766194, 45.6201656576528, -101.356002952935, 45.6203735586541, -101.355390364335, 45.6205164309878, -101.354498798057, 45.6206433292767, -101.353565419121, 45.6205106493372, -101.352529371184, 45.62014136876, -101.352633917731, 45.6196834560759, -101.352647567195, 45.6192708429218, -101.352508539361, 45.6189047511931, -101.352288629886, 45.6188224967832, -101.351470703284, 45.6184921082368, -101.350941771666, 45.6184161719192, -101.349821234145, 45.6182439144956, -101.348940635122, 45.6178931113583, -101.348338153234, 45.6175365563727, -101.347801113521, 45.6172654744479, -101.347174072657, 45.6170613583416, -101.346421623621, 45.6168163832512, -101.34560739437, 45.6165726896607, -101.345082128437, 45.6165834781014, -101.345099443586, 45.6162575897056, -101.345027709396, 45.6160203334168, -101.344768758879, 45.6157435294461, -101.344570720584, 45.6154437776871, -101.343946421534, 45.615304660446, -101.343533003717, 45.6150310155214, -101.343056881814, 45.614736956006, -101.342713410048, 45.6146572049912, -101.342468017725, 45.6147056337651, -101.342197174219, 45.6148848053276, -101.341594750073, 45.614528250342, -101.340900564577, 45.6141952391912, -101.339942956353, 45.6134770032207, -101.339244270705, 45.6130355712208, -101.338453823708, 45.6126177128581, -101.337701464078, 45.612372678163, -101.336212122817, 45.6122512635015, -101.336192304272, 45.6117742177263, -101.335945421833, 45.6110413786178, -101.335616642612, 45.610570650935, -101.335230583328, 45.6102096256011, -101.334946239369, 45.6100635346166, -101.334630066531, 45.6098963733901, -101.334438407795, 45.6097483750569, -101.334307605402, 45.6095774289354, -101.3340868596, 45.6094734188302, -101.333838785068, 45.6094567891342, -101.332731360569, 45.6088500734542, -101.332383448257, 45.6086618419858, -101.331784749401, 45.6083919521539, -101.331092501056, 45.6081022437775, -101.330252939831, 45.6079891737662, -101.329314434895, 45.6077261980731, -101.328373249613, 45.6073981639101, -101.327992642291, 45.6071671959113, -101.327608460552, 45.6068495031542, -101.327069813377, 45.6065349396409, -101.32641475833, 45.606396388644, -101.325643325214, 45.6064337905586, -101.324999922875, 45.6065771099272, -101.324193533497, 45.6057688411406, -101.323838466765, 45.6054071303533, -101.323051804662, 45.6050759073418, -101.321817005037, 45.6051227267903, -101.320397699234, 45.6051949676199, -101.319817000981, 45.6053587015793, -101.319392526503, 45.6055626388717, -101.318969869966, 45.6058099385432, -101.318444663638, 45.6058206077746, -101.318069482201, 45.6057197269132, -101.31775161063, 45.6055091437029, -101.317426586501, 45.6051251109761, -101.317134255521, 45.6047838147796, -101.316515529505, 45.6047746654667, -101.316021228185, 45.604784679047, -101.315613385265, 45.6046410318529, -101.315201038469, 45.6043889638098, -101.314971411575, 45.6040680822042, -101.31476911341, 45.6036598499915, -101.314480358708, 45.6034052785534, -101.313899660456, 45.6035689529081, -101.313442522632, 45.6037301536702, -101.312765562878, 45.603808980813, -101.312275731907, 45.60392738544, -101.311693215712, 45.6040476974156, -101.311207855089, 45.604274552694, -101.310601586444, 45.6045689698373, -101.310057962281, 45.6048837717691, -101.309517020326, 45.6052636619731, -101.309069657664, 45.6056633707215, -101.308727139573, 45.6056051667858, -101.308470213751, 45.6053716357872, -101.307939672807, 45.6052521582766, -101.307710969785, 45.6049529429594, -101.307511383632, 45.6046097394143, -101.307343566754, 45.6042876061112, -101.306859726049, 45.6037982221746, -101.306751036979, 45.603409778704, -101.306707706265, 45.6031068380966, -101.306268120147, 45.6029420908582, -101.305856728888, 45.6027116593011, -101.305445367431, 45.6024812575464, -101.304879540538, 45.6022539552333, -101.304159248207, 45.6020297523616, -101.303322518202, 45.601981532204, -101.301559025377, 45.6019519981024, -101.301253640979, 45.6020449515461, -101.301012719005, 45.6022017415644, -101.300863588183, 45.6023349579456, -101.30071442756, 45.6024681743269, -101.300475293725, 45.602668296922, -101.300171669526, 45.6028046425471, -101.2997409645, 45.6028567370067, -101.29930492672, 45.6027786847243, -101.298837985795, 45.6027012880929, -101.298432851161, 45.602622639764, -101.297905918161, 45.602589827407, -101.29769497546, 45.6027242954858, -101.296937638843, 45.6023488756302, -101.296058501996, 45.6020193513511, -101.295742506109, 45.6018520709153, -101.295029336533, 45.6018013175602, -101.294627750238, 45.6018093641873, -101.294042551835, 45.6018645282861, -101.293456491027, 45.6018980260965, -101.292775118667, 45.6018682833787, -101.292278196605, 45.6018131788845, -101.291873063834, 45.6017345007533, -101.291283482627, 45.6016812142008, -101.290510291174, 45.6016750153178, -101.290393764093, 45.6010913964376, -101.290285224035, 45.6007029529671, -101.289931293516, 45.6003627892589, -101.289362009553, 45.6000486727805, -101.288850124863, 45.5996249135578, -101.288520032477, 45.5991106744843, -101.288505041909, 45.5987420197559, -101.288652444196, 45.5985654409955, -101.288862490964, 45.5984093364306, -101.288852807072, 45.5981707986419, -101.28867276938, 45.5975450392778, -101.288897836519, 45.596997958045, -101.289324099137, 45.596837502341, -101.289565915181, 45.5967024382158, -101.289805972888, 45.5965240117114, -101.290201362162, 45.5963641818562, -101.290604675129, 45.596399467806, -101.290402587443, 45.595991205791, -101.290436979323, 45.5953177329087, -101.29079088004, 45.5948982950229, -101.29132830532, 45.5944317694676, -101.292452627736, 45.5939534421926, -101.292937094289, 45.5937049802305, -101.29280736478, 45.5935556705951, -101.292658204156, 45.5929293151846, -101.292974973041, 45.5923586901171, -101.293683553059, 45.5915414806337, -101.293267900068, 45.5912025686231, -101.293135518152, 45.5909882303201, -101.292554849702, 45.5903922136739, -101.292436564284, 45.5897652324146, -101.292644822913, 45.5895657356683, -101.292598033267, 45.5891760106979, -101.292432123738, 45.5888972099715, -101.292022699432, 45.5887101109913, -101.291674131469, 45.5885000940252, -101.291282320336, 45.5879871066492, -101.291144663409, 45.5876426216042, -101.29097964795, 45.5873855169686, -101.290649648696, 45.5868712778951, -101.290548171788, 45.5866562839411, -101.290633764058, 45.5864809568783, -101.290565814763, 45.5863303955453, -101.290284329965, 45.5862492438214, -101.289840483977, 45.5859760161293, -101.289512241198, 45.585505139435, -101.288992548299, 45.5848862048027, -101.287976110291, 45.5842121060717, -101.28714584739, 45.5835559483388, -101.286212408849, 45.582641464075, -101.285476619311, 45.5820268209773, -101.28511842706, 45.5815782364201, -101.284357035464, 45.5810943063084, -101.283982956713, 45.5810150023285, -101.283165121381, 45.5806624110518, -101.282134646478, 45.5804008956725, -101.28119328052, 45.5800507481863, -101.280940079988, 45.5799039121436, -101.280586356223, 45.5795637186331, -101.280392313302, 45.5793505724231, -101.279982948601, 45.5791634436406, -101.279688352644, 45.578756969765, -101.279088491498, 45.5784434195307, -101.278616512118, 45.5782358165526, -101.278077537117, 45.5778993185301, -101.277262385856, 45.577611755921, -101.276535535152, 45.5772138949165, -101.276191467339, 45.5771122391947, -101.275848295459, 45.5770322795636, -101.275343740278, 45.5767819102529, -101.275118824013, 45.5765693600894, -101.274914288812, 45.5760959799999, -101.274648869328, 45.5756455476987, -101.274266060359, 45.5753493424161, -101.273919397882, 45.5751826282244, -101.273802246815, 45.5745772834512, -101.273471588185, 45.5740413184846, -101.272609019567, 45.5733423050121, -101.271817859176, 45.572880607433, -101.270905848505, 45.5724863823119, -101.270488705398, 45.5721040483174, -101.270042473362, 45.5717656727486, -101.269714469001, 45.5712947662519, -101.269444757983, 45.570735853497, -101.268835419699, 45.5701837058694, -101.268133455796, 45.5696333761834, -101.268205100579, 45.5691110904828, -101.26744928388, 45.568757187904, -101.267126584333, 45.5684163387424, -101.266455525439, 45.5678654130099, -101.265675838942, 45.5676855559941, -101.265751028339, 45.5672500248541, -101.26570009617, 45.5667518790347, -101.265420818607, 45.5659544284911, -101.265470707694, 45.5648900385455, -101.266117954533, 45.5633146281773, -101.265613043586, 45.5622829313794, -101.264529073515, 45.5622176046887, -101.263660335816, 45.5621263201751, -101.262631142413, 45.5618862922702, -101.262095892702, 45.5616364892036, -101.261493677173, 45.5612577612902, -101.260768886554, 45.5609031732579, -101.260109301554, 45.560634117891, -101.259364927084, 45.5605620260731, -101.258433636173, 45.5604502375616, -101.258130157261, 45.5605864639775, -101.257646644382, 45.5608564432164, -101.257036203412, 45.5610421414874, -101.255992675092, 45.561214667132, -101.255111807848, 45.5608197267551, -101.253763582446, 45.56032548504, -101.25254317548, 45.5599372203833, -101.250823670883, 45.5594285841464, -101.249551111715, 45.5592800493715, -101.248095059648, 45.5591785128589, -101.246515506757, 45.5590793903345, -101.245464231696, 45.5590566511625, -101.24486734892, 45.5588079805842, -101.244539642582, 45.5583369548782, -101.244295921052, 45.5576472695325, -101.243470901498, 45.5570992346254, -101.242128874979, 45.5567566569291, -101.241258526092, 45.5566218312224, -101.240575099234, 45.5565267320115, -101.23947145963, 45.555962395234, -101.238539391996, 45.5558287616202, -101.237818235398, 45.5555607791369, -101.236225064708, 45.5551145191609, -101.235286110875, 45.5548073764259, -101.234401190515, 45.5543038363861, -101.233707511658, 45.5539484734935, -101.23302241587, 45.5538099522988, -101.232221597664, 45.5538690205019, -101.23142593526, 45.5540582056447, -101.230327600469, 45.5544051940847, -101.229248100746, 45.5544479902197, -101.228566462028, 45.5543961937834, -101.227913105713, 45.5542787130283, -101.227145695911, 45.5544022138525, -101.226524913534, 45.5543274994301, -101.225349390728, 45.5542852993416, -101.224003219824, 45.5546153600625, -101.222625726679, 45.5549351687845, -101.222261780718, 45.5547143931799, -101.221933806159, 45.5546231086663, -101.22143524497, 45.5545134361198, -101.220859074808, 45.5543944354463, -101.220216894364, 45.5541682060168, -101.219464951967, 45.5539007003706, -101.21886568873, 45.5535867925085, -101.218146348211, 45.5533620531951, -101.217718565675, 45.5530882294566, -101.217145049782, 45.5526436086083, -101.216522240848, 45.5521240051167, -101.216158741921, 45.5519140477552, -101.215845400303, 45.5518007393253, -101.215579623192, 45.5517191107642, -101.215282136409, 45.5516163523564, -101.214870238511, 45.5513530786401, -101.214412027804, 45.5510906691911, -101.213885688987, 45.5506668503638, -101.213667088952, 45.5506059642191, -101.213416749444, 45.5505240078324, -101.213287764992, 45.5503854568355, -101.21290927736, 45.5501866157402, -101.212607139553, 45.5499645884381, -101.212244087661, 45.5497654493196, -101.211807424033, 45.5492639060355, -101.211671614849, 45.5489518459173, -101.211414510214, 45.5486964102118, -101.211099469863, 45.5485397394028, -101.210731530391, 45.5482989068352, -101.210504585705, 45.5483697767579, -101.210120374165, 45.5484073276842, -101.210267687044, 45.5488862212033, -101.210266446523, 45.5493596478589, -101.274968132295, 45.6085839424402, -101.367659850094, 45.6250958279126));
       polygon2 :=
          SDO_GEOMETRY(2003, 8265, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1),
          SDO_ORDINATE_ARRAY(-101.365627851382, 45.6219975468078, -101.366095924796, 45.6220963415067, -101.366628551902, 45.6222589429779, -101.366629328625, 45.6222646352215, -101.366620268719, 45.6220802780549, -101.366700496571, 45.62182305421, -101.366595413582, 45.6214897748383, -101.366373265208, 45.6210790690329, -101.366263473452, 45.6206340607544, -101.367038125219, 45.6206499751946, -101.367585325661, 45.6206705685994, -101.367529088679, 45.6204161461728, -101.367560440722, 45.6200800355804, -101.367629254285, 45.6195514913921, -101.367714576471, 45.6193683542582, -101.257581859721, 45.5548077973837, -101.211696997115, 45.5464650954303, -101.211825365031, 45.5468085820975, -101.21181919595, 45.5474711175274, -101.211578810417, 45.5478973205405, -101.210864418946, 45.5482574220024, -101.210731530391, 45.5482989068352, -101.211099469863, 45.5485397394028, -101.211414510214, 45.5486964102118, -101.211671614849, 45.5489518459173, -101.211807424033, 45.5492639060355, -101.212244087661, 45.5497654493196, -101.212607139553, 45.5499645884381, -101.21290927736, 45.5501866157402, -101.213287764992, 45.5503854568355, -101.213416749444, 45.5505240078324, -101.213667088952, 45.5506059642191, -101.213885688987, 45.5506668503638, -101.214412027804, 45.5510906691911, -101.214870238511, 45.5513530786401, -101.215282136409, 45.5516163523564, -101.215579623192, 45.5517191107642, -101.215845400303, 45.5518007393253, -101.216158741921, 45.5519140477552, -101.216522240848, 45.5521240051167, -101.217145049782, 45.5526436086083, -101.217718565675, 45.5530882294566, -101.218146348211, 45.5533620531951, -101.21886568873, 45.5535867925085, -101.219464951967, 45.5539007003706, -101.220216894364, 45.5541682060168, -101.220859074808, 45.5543944354463, -101.22143524497, 45.5545134361198, -101.221933806159, 45.5546231086663, -101.222261780718, 45.5547143931799, -101.222625726679, 45.5549351687845, -101.224003219824, 45.5546153600625, -101.225349390728, 45.5542852993416, -101.226524913534, 45.5543274994301, -101.227145695911, 45.5544022138525, -101.227913105713, 45.5542787130283, -101.228566462028, 45.5543961937834, -101.229248100746, 45.5544479902197, -101.230327600469, 45.5544051940847, -101.23142593526, 45.5540582056447, -101.232221597664, 45.5538690205019, -101.23302241587, 45.5538099522988, -101.233707511658, 45.5539484734935, -101.234401190515, 45.5543038363861, -101.235286110875, 45.5548073764259, -101.236225064708, 45.5551145191609, -101.237818235398, 45.5555607791369, -101.238539391996, 45.5558287616202, -101.23947145963, 45.555962395234, -101.240575099234, 45.5565267320115, -101.241258526092, 45.5566218312224, -101.242128874979, 45.5567566569291, -101.243470901498, 45.5570992346254, -101.244295921052, 45.5576472695325, -101.244539642582, 45.5583369548782, -101.24486734892, 45.5588079805842, -101.245464231696, 45.5590566511625, -101.246515506757, 45.5590793903345, -101.248095059648, 45.5591785128589, -101.249551111715, 45.5592800493715, -101.250823670883, 45.5594285841464, -101.25254317548, 45.5599372203833, -101.253763582446, 45.56032548504, -101.255111807848, 45.5608197267551, -101.255992675092, 45.561214667132, -101.257036203412, 45.5610421414874, -101.257646644382, 45.5608564432164, -101.258130157261, 45.5605864639775, -101.258433636173, 45.5604502375616, -101.259364927084, 45.5605620260731, -101.260109301554, 45.560634117891, -101.260768886554, 45.5609031732579, -101.261493677173, 45.5612577612902, -101.262095892702, 45.5616364892036, -101.262631142413, 45.5618862922702, -101.263660335816, 45.5621263201751, -101.264529073515, 45.5622176046887, -101.265613043586, 45.5622829313794, -101.266117954533, 45.5633146281773, -101.265470707694, 45.5648900385455, -101.265420818607, 45.5659544284911, -101.26570009617, 45.5667518790347, -101.265751028339, 45.5672500248541, -101.265675838942, 45.5676855559941, -101.266455525439, 45.5678654130099, -101.267126584333, 45.5684163387424, -101.26744928388, 45.568757187904, -101.268205100579, 45.5691110904828, -101.268133455796, 45.5696333761834, -101.268835419699, 45.5701837058694, -101.269444757983, 45.570735853497, -101.269714469001, 45.5712947662519, -101.270042473362, 45.5717656727486, -101.270488705398, 45.5721040483174, -101.270905848505, 45.5724863823119, -101.271817859176, 45.572880607433, -101.272609019567, 45.5733423050121, -101.273471588185, 45.5740413184846, -101.273802246815, 45.5745772834512, -101.273919397882, 45.5751826282244, -101.274266060359, 45.5753493424161, -101.274648869328, 45.5756455476987, -101.274914288812, 45.5760959799999, -101.275118824013, 45.5765693600894, -101.275343740278, 45.5767819102529, -101.275848295459, 45.5770322795636, -101.276191467339, 45.5771122391947, -101.276535535152, 45.5772138949165, -101.277262385856, 45.577611755921, -101.278077537117, 45.5778993185301, -101.278616512118, 45.5782358165526, -101.279088491498, 45.5784434195307, -101.279688352644, 45.578756969765, -101.279982948601, 45.5791634436406, -101.280392313302, 45.5793505724231, -101.280586356223, 45.5795637186331, -101.280940079988, 45.5799039121436, -101.28119328052, 45.5800507481863, -101.282134646478, 45.5804008956725, -101.283165121381, 45.5806624110518, -101.283982956713, 45.5810150023285, -101.284357035464, 45.5810943063084, -101.28511842706, 45.5815782364201, -101.285476619311, 45.5820268209773, -101.286212408849, 45.582641464075, -101.28714584739, 45.5835559483388, -101.287976110291, 45.5842121060717, -101.288992548299, 45.5848862048027, -101.289512241198, 45.585505139435, -101.289840483977, 45.5859760161293, -101.290284329965, 45.5862492438214, -101.290565814763, 45.5863303955453, -101.290633764058, 45.5864809568783, -101.290548171788, 45.5866562839411, -101.290649648696, 45.5868712778951, -101.29097964795, 45.5873855169686, -101.291144663409, 45.5876426216042, -101.291282320336, 45.5879871066492, -101.291674131469, 45.5885000940252, -101.292022699432, 45.5887101109913, -101.292432123738, 45.5888972099715, -101.292598033267, 45.5891760106979, -101.292644822913, 45.5895657356683, -101.292436564284, 45.5897652324146, -101.292554849702, 45.5903922136739, -101.293135518152, 45.5909882303201, -101.293267900068, 45.5912025686231, -101.293683553059, 45.5915414806337, -101.292974973041, 45.5923586901171, -101.292658204156, 45.5929293151846, -101.29280736478, 45.5935556705951, -101.292937094289, 45.5937049802305, -101.292452627736, 45.5939534421926, -101.29132830532, 45.5944317694676, -101.29079088004, 45.5948982950229, -101.290436979323, 45.5953177329087, -101.290402587443, 45.595991205791, -101.290604675129, 45.596399467806, -101.290201362162, 45.5963641818562, -101.289805972888, 45.5965240117114, -101.289565915181, 45.5967024382158, -101.289324099137, 45.596837502341, -101.288897836519, 45.596997958045, -101.28867276938, 45.5975450392778, -101.288852807072, 45.5981707986419, -101.288862490964, 45.5984093364306, -101.288652444196, 45.5985654409955, -101.288505041909, 45.5987420197559, -101.288520032477, 45.5991106744843, -101.288850124863, 45.5996249135578, -101.289362009553, 45.6000486727805, -101.289931293516, 45.6003627892589, -101.290285224035, 45.6007029529671, -101.290393764093, 45.6010913964376, -101.290510291174, 45.6016750153178, -101.291283482627, 45.6016812142008, -101.291873063834, 45.6017345007533, -101.292278196605, 45.6018131788845, -101.292775118667, 45.6018682833787, -101.293456491027, 45.6018980260965, -101.294042551835, 45.6018645282861, -101.294627750238, 45.6018093641873, -101.295029336533, 45.6018013175602, -101.295742506109, 45.6018520709153, -101.296058501996, 45.6020193513511, -101.296937638843, 45.6023488756302, -101.29769497546, 45.6027242954858, -101.297905918161, 45.602589827407, -101.298432851161, 45.602622639764, -101.298837985795, 45.6027012880929, -101.29930492672, 45.6027786847243, -101.2997409645, 45.6028567370067, -101.300171669526, 45.6028046425471, -101.300475293725, 45.602668296922, -101.30071442756, 45.6024681743269, -101.300863588183, 45.6023349579456, -101.301012719005, 45.6022017415644, -101.301253640979, 45.6020449515461, -101.301559025377, 45.6019519981024, -101.303322518202, 45.601981532204, -101.304159248207, 45.6020297523616, -101.304879540538, 45.6022539552333, -101.305445367431, 45.6024812575464, -101.305856728888, 45.6027116593011, -101.306268120147, 45.6029420908582, -101.306707706265, 45.6031068380966, -101.306751036979, 45.603409778704, -101.306859726049, 45.6037982221746, -101.307343566754, 45.6042876061112, -101.307511383632, 45.6046097394143, -101.307710969785, 45.6049529429594, -101.307939672807, 45.6052521582766, -101.308470213751, 45.6053716357872, -101.308727139573, 45.6056051667858, -101.309069657664, 45.6056633707215, -101.309517020326, 45.6052636619731, -101.310057962281, 45.6048837717691, -101.310601586444, 45.6045689698373, -101.311207855089, 45.604274552694, -101.311693215712, 45.6040476974156, -101.312275731907, 45.60392738544, -101.312765562878, 45.603808980813, -101.313442522632, 45.6037301536702, -101.313899660456, 45.6035689529081, -101.314480358708, 45.6034052785534, -101.31476911341, 45.6036598499915, -101.314971411575, 45.6040680822042, -101.315201038469, 45.6043889638098, -101.315613385265, 45.6046410318529, -101.316021228185, 45.604784679047, -101.316515529505, 45.6047746654667, -101.317134255521, 45.6047838147796, -101.317426586501, 45.6051251109761, -101.31775161063, 45.6055091437029, -101.318069482201, 45.6057197269132, -101.318444663638, 45.6058206077746, -101.318969869966, 45.6058099385432, -101.319392526503, 45.6055626388717, -101.319817000981, 45.6053587015793, -101.320397699234, 45.6051949676199, -101.321817005037, 45.6051227267903, -101.323051804662, 45.6050759073418, -101.323838466765, 45.6054071303533, -101.324193533497, 45.6057688411406, -101.324999922875, 45.6065771099272, -101.325643325214, 45.6064337905586, -101.32641475833, 45.606396388644, -101.327069813377, 45.6065349396409, -101.327608460552, 45.6068495031542, -101.327992642291, 45.6071671959113, -101.328373249613, 45.6073981639101, -101.329314434895, 45.6077261980731, -101.330252939831, 45.6079891737662, -101.331092501056, 45.6081022437775, -101.331784749401, 45.6083919521539, -101.332383448257, 45.6086618419858, -101.332731360569, 45.6088500734542, -101.333838785068, 45.6094567891342, -101.3340868596, 45.6094734188302, -101.334307605402, 45.6095774289354, -101.334438407795, 45.6097483750569, -101.334630066531, 45.6098963733901, -101.334946239369, 45.6100635346166, -101.335230583328, 45.6102096256011, -101.335616642612, 45.610570650935, -101.335945421833, 45.6110413786178, -101.336192304272, 45.6117742177263, -101.336212122817, 45.6122512635015, -101.337701464078, 45.612372678163, -101.338453823708, 45.6126177128581, -101.339244270705, 45.6130355712208, -101.339942956353, 45.6134770032207, -101.340900564577, 45.6141952391912, -101.341594750073, 45.614528250342, -101.342197174219, 45.6148848053276, -101.342468017725, 45.6147056337651, -101.342713410048, 45.6146572049912, -101.343056881814, 45.614736956006, -101.343533003717, 45.6150310155214, -101.343946421534, 45.615304660446, -101.344570720584, 45.6154437776871, -101.344768758879, 45.6157435294461, -101.345027709396, 45.6160203334168, -101.345099443586, 45.6162575897056, -101.345082128437, 45.6165834781014, -101.34560739437, 45.6165726896607, -101.346421623621, 45.6168163832512, -101.347174072657, 45.6170613583416, -101.347801113521, 45.6172654744479, -101.348338153234, 45.6175365563727, -101.348940635122, 45.6178931113583, -101.349821234145, 45.6182439144956, -101.350941771666, 45.6184161719192, -101.351470703284, 45.6184921082368, -101.352288629886, 45.6188224967832, -101.352508539361, 45.6189047511931, -101.352647567195, 45.6192708429218, -101.352633917731, 45.6196834560759, -101.352529371184, 45.62014136876, -101.353565419121, 45.6205106493372, -101.354498798057, 45.6206433292767, -101.355390364335, 45.6205164309878, -101.356002952935, 45.6203735586541, -101.356612766194, 45.6201656576528, -101.357067192006, 45.6199392494093, -101.357368016649, 45.619737726105, -101.3577215616, 45.6200559553039, -101.358076000621, 45.6203958805935, -101.358182365109, 45.6207192059896, -101.358967626503, 45.6210068282033, -101.359874660186, 45.6212484952359, -101.360873514825, 45.6214665886314, -101.361686971078, 45.6216884967243, -101.362436795648, 45.6218682941355, -101.363214785275, 45.6219824072281, -101.363654697356, 45.6221469160479, -101.364110017238, 45.6219421740928, -101.364448124586, 45.6218917783656, -101.364973450124, 45.6218808707156, -101.365627851382, 45.6219975468078));
       DBMS_OUTPUT.put_line('------------');
       DBMS_OUTPUT.put_line('polygon1 validation at ' || TO_CHAR(num_tolerance) || ' = ' || SDO_GEOM.validate_geometry_with_context(polygon1, num_tolerance));
       DBMS_OUTPUT.put_line('polygon2 validation at ' || TO_CHAR(num_tolerance) || ' = ' || SDO_GEOM.validate_geometry_with_context(polygon2, num_tolerance));
       DBMS_OUTPUT.put_line('combined area is ' || TO_CHAR(SDO_GEOM.sdo_area(polygon1, num_tolerance) + SDO_GEOM.sdo_area(polygon2, num_tolerance)));
       rez_oldschool_sdo_union := SDO_GEOM.SDO_UNION(polygon1, polygon2, num_tolerance);
       SELECT SDO_AGGR_UNION(sdoaggrtype(a.shape, num_tolerance)) INTO rez_aggr_union FROM (SELECT polygon1 shape FROM DUAL UNION ALL SELECT polygon2 shape FROM DUAL) a;
       rez_aggr_set_union := SDO_AGGR_SET_UNION(mdsys.sdo_geometry_array(polygon1, polygon2),num_tolerance);
       DBMS_OUTPUT.put_line('------------');
       DBMS_OUTPUT.put_line('sdo_union creates GTYPE ' || TO_CHAR(rez_oldschool_sdo_union.sdo_gtype));
       DBMS_OUTPUT.put_line('sdo_aggr_union creates GTYPE ' || TO_CHAR(rez_aggr_union.sdo_gtype));
       DBMS_OUTPUT.put_line('sdo_aggr_set_union creates GTYPE ' || TO_CHAR(rez_aggr_set_union.sdo_gtype));
       DBMS_OUTPUT.put_line('------------');
       DBMS_OUTPUT.put_line('sdo_union creates area of ' || TO_CHAR(SDO_GEOM.sdo_area(rez_oldschool_sdo_union, num_tolerance)));
       DBMS_OUTPUT.put_line('sdo_aggr_union creates area of ' || TO_CHAR(SDO_GEOM.sdo_area(rez_aggr_union, num_tolerance)));
       DBMS_OUTPUT.put_line('sdo_aggr_set_union creates area of ' || TO_CHAR(SDO_GEOM.sdo_area(rez_aggr_set_union, num_tolerance)));
    END;
    /

    Hi Paul,
    I'm not sure where you see the mistake.
    I run your script on Version 11.2.0.1 (function sdo_aggr_set_union is already here) and get the following result:
    polygon1 validation at ,05 = TRUE
    polygon2 validation at ,05 = TRUE
    combined area is 34338292,4039011
    sdo_union creates GTYPE 2003
    sdo_aggr_union creates GTYPE 2003
    sdo_aggr_set_union creates GTYPE 2003
    sdo_union creates area of 34338291,3352027
    sdo_aggr_union creates area of 34338293,6868519
    sdo_aggr_set_union creates area of 34338291,3352027
    The area of sdo_union and sdo_aggr_set_union are the same. Can you please point out, where your problem is exactly? Maybe in 11.2.0.1 the function was different?
    Udo

  • SDO_GEOM.SDO_BUFFER failed with ORA-13050

    Hello,
    I want to construct buffer for polylines.
    SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT function returns TRUE for problem geometries:
    SELECT SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(
    MDSYS.SDO_GEOMETRY(2002, NULL, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1, 2, 1), MDSYS.S
    121.75439, 31.37049, 121.75234, 31.36996, 121.75245, 31.37184, 121.75262, 31.373
    121.75232, 31.37518, 121.74977, 31.37854)), 1e-7)
    from dual
    SDO_GEOM.VALIDATE_GEOMETRY_WIT
    TRUE
    But SDO_BUFFER fails:
    SELECT SDO_GEOM.SDO_BUFFER(
    MDSYS.SDO_GEOMETRY(2002, NULL, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1, 2, 1), MDSYS.SDO_ORDINATE_ARRAY(
    121.75439, 31.37049, 121.75234, 31.36996, 121.75245, 31.37184, 121.75262, 31.37362, 121.75253, 31.37449,
    121.75232, 31.37518, 121.74977, 31.37854)), 1e-5, 1e-7)
    from dual;
    Can somebody help me with advice how to construct buffer?
    I have SDO_VERSION=9.2.0.5.0
    Data tolerance in the user_sdo_geom_metadata table is 1e-7.
    Thank you.
    PS:
    Other example of problem polyline:
    MDSYS.SDO_GEOMETRY(2002, NULL, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1, 2, 1), MDSYS.SDO_ORDINATE_ARRAY(
    121.68669, 31.3819, 121.68675, 31.3822, 121.68665, 31.38219, 121.68668, 31.3824,
    121.6867, 31.38242, 121.68676, 31.38241, 121.68679, 31.38254, 121.68682, 31.38254, 121.6868, 31.3824))

    Hello.
    I’m still trying to find out resolution for buffers construction :)
    Actually I've got that buffer construction works much better on geodesic data.
    Next statement is OK now:
    SELECT SDO_GEOM.SDO_BUFFER(
    MDSYS.SDO_GEOMETRY(2002, 8307, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1, 2, 1), MDSYS.SDO_ORDINATE_ARRAY(
    121.75439, 31.37049, 121.75234, 31.36996, 121.75245, 31.37184, 121.75262, 31.37362, 121.75253, 31.37449,
    121.75232, 31.37518, 121.74977, 31.37854)), 1, 1e-2, 'arc_tolerance=0.5')
    from dual;
    I run large test and got only one (currently) issue with the next poliline [ORA-13050: unable to construct spatial object]:
    select SDO_GEOM.SDO_BUFFER(
    MDSYS.SDO_GEOMETRY(2002, 8307, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1, 2, 1), MDSYS.SDO_ORDINATE_ARRAY(
    117.56163, 23.74977999, 117.56163, 23.74949001, 117.56163, 23.7492, 117.56117999, 23.74906)),
    1, 1e-2, 'arc_tolerance=0.5') from dual;
    What is wrong with that poliline?
    Are there any rules or workarounds for such cases? Can some body suggest me something about that?
    I've found only 2 workarounds for that time:
    1) I need to construct buffer within 1 millimeter tolerance. So I can round input geometry ordinates to 1 millimeter (1e-7) and try to build buffer after that. I did it for above poliline - and it works (actually it is necessary to round only second ordinate 23.74977999->23.7497799). But I don't sure that it will resolve issue entirely.
    2) I can iteratively slightly increase buffer distance until buffer construction will be OK. Above example works starting from 1.3 meter. It is not best resolution because it can alter process logic.
    Thank you.

  • How find the errors (sdo_geom.validate TRUE) in objects

    Hi, I've many layers of polygons with topologycal errors (loaded from Mapinfo 7.5 , the function sdo_geom.validate_geometry_with_context give error 13349, probably there are some ring, edge etc...
    But there is a metod, program, utility to find where the errors are to correct them?

    Fabio,
    Error 13349 indicates that the polygons intersect with themselves.
    You need to fix these errors. There are tools in MapInfo Professional 7.5 to check and automatically fix them. There are other tools commercially available which also fix geometry errors.
    If you know MapInfo I would fix these errors there.
    Ivan

Maybe you are looking for

  • Creating the New Update groups in case of the Credit Management

    Hi Can any one help out in the following requirement:   Is it possible to Create a new update group in case of the Credit Management?SAP standard provides only three update groups viz., 000012, 000015 and 000018. We would like to have a customized gr

  • Stacks and Printer Problems in Leopard

    I just found two problems regarding the new stacks feature and my HP C4280 printer. For the stacks, I left the download stack open, which shows a fan of downloaded files, while downloading something else. but when the new downloading finished. My who

  • How to use multiple datasource in spring and hibernate

    HI all, I want to use multiple data source for my web application.Please suggest me the mapping of xml files viz. applicationContext-resource.xml,applicationContext-hibernate.xml and applicationContext-service.xml SHoud i create separate session fact

  • Count of string

    Hi All, I have a  field carton no which is string type.The values are 1 and 2. I gave summary as count for that in report footer .But it is showing 32 .But it should show 2 only. Here the report having 32 records .I tried with changing string to numb

  • External Rest API call from SharePoint 2013 On Premises

    Hi All, May my questions is silly but I am totally tired by trying different things. I need to call a third party rest api from my SharePoint Designer page using &Ajax call.First time when i tried it gave me access denied then added this line jQuery.