Sdo_geom

HI
I am working with Oracle 11.2.0.1.0. The following query gives incorrect result. There are two geometries, they are DISJOINT but the query says that it is INSIDE
select sdo_geom.relate(a.geometry, 'determine', b.geometry, 0.05) from test a, test b where a.idnumber='axy' and b.idnumber='abcd';
The geometries are given below.
abcd MDSYS.SDO_GEOMETRY(2003,8307,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1),MDSYS.SDO_ORDINATE_ARRAY(-63.511895146,44.883927382,-63.511917747,44.883932719,-63.511943823,44.883931141,-63.51234812,44.883862534,-63.512410738,44.88381001,-63.512641895,44.883616114,-63.512867359,44.88342672,-63.512910261,44.883383825,-63.513899075,44.882385966,-63.515021288,44.88124581,-63.515320558,44.880941675,-63.51553685,44.880721866,-63.515847735,44.880405706,-63.51680081,44.879436458,-63.517103832,44.879128292,-63.517949007,44.878268728,-63.518479978,44.87772787,-63.518536077,44.877670724,-63.519862136,44.876324062,-63.520352141,44.875826445,-63.520875977,44.87529447,-63.521012779,44.87515414,-63.521029469,44.875134851,-63.521038752,44.875117469,-63.521046038,44.875094454,-63.521048577,44.875072368,-63.521046494,44.875048106,-63.521040844,44.875027953,-63.52103162,44.875008859,-63.521019009,44.874991525,-63.521007524,44.874978615,-63.520990199,44.874959284,-63.520968364,44.874936809,-63.520940738,44.874911432,-63.520880061,44.874862375,-63.520848717,44.874840831,-63.520786635,44.874798894,-63.520716909,44.87475688,-63.520654302,44.87472334,-63.520595816,44.874695319,-63.520515013,44.874662486,-63.520428784,44.874634104,-63.520350631,44.874613439,-63.520278473,44.874598439,-63.520198047,44.874586401,-63.520111209,44.874577969,-63.520030138,44.874573262,-63.519940956,44.874571591,-63.519864301,44.874573084,-63.519778699,44.874576795,-63.519678073,44.874584332,-63.519579202,44.874595104,-63.519494358,44.874607036,-63.519408372,44.874621695,-63.519327355,44.874637906,-63.5192365,44.874658704,-63.519146286,44.87468136,-63.519068168,44.874703018,-63.518959636,44.874736331,-63.518903063,44.874755342,-63.518846253,44.874775112,-63.518734517,44.874888332,-63.518819058,44.874842649,-63.518911751,44.874805767,-63.518987812,44.874779833,-63.519068179,44.874756665,-63.519145115,44.874733827,-63.519236361,44.874709944,-63.519317179,44.874691623,-63.519397124,44.87467606,-63.519484395,44.874661925,-63.519579638,44.874649845,-63.519683429,44.874636,-63.519759209,44.87462827,-63.519846351,44.87462252,-63.519921021,44.874620247,-63.51997481,44.874620122,-63.520026922,44.874621208,-63.520065397,44.874622774,-63.520116942,44.874628591,-63.52017073,44.874635781,-63.520235021,44.874645889,-63.520280769,44.874654097,-63.520326648,44.874663184,-63.520375078,44.874673719,-63.520425629,44.874687552,-63.520482676,44.874707912,-63.520528305,44.874726295,-63.520576379,44.87474778,-63.520632999,44.874776024,-63.520716465,44.874823086,-63.520783988,44.874867665,-63.52083892,44.874909345,-63.520882895,44.874944811,-63.520901148,44.874963038,-63.520909245,44.874980936,-63.520907967,44.875005651,-63.520897312,44.875041872,-63.520863074,44.875132124,-63.520839957,44.875175126,-63.520794797,44.875224578,-63.520599847,44.875421292,-63.5183909,44.877657061,-63.518139304,44.877922764,-63.513933818,44.882196182,-63.513853277,44.882276678,-63.512799484,44.883329899,-63.512687478,44.883425868,-63.51262839,44.883472607,-63.512545714,44.883531,-63.512460967,44.883591331,-63.512370783,44.88364668,-63.512277899,44.883698706,-63.512239574,44.883718778,-63.512214286,44.883731593,-63.512183522,44.883745273,-63.512164668,44.883751508,-63.512138925,44.883759169,-63.512107764,44.883767169,-63.512079528,44.883773247,-63.512043277,44.88377946,-63.512007231,44.883783905,-63.511967858,44.883786821,-63.511934709,44.883787722,-63.511905193,44.883787333,-63.511866053,44.883785083,-63.511843135,44.883782842,-63.511807275,44.883773062,-63.511784093,44.883763448,-63.511752174,44.883749749,-63.511716923,44.883733988,-63.511673453,44.883713618,-63.511621498,44.883687881,-63.511531986,44.883639829,-63.511326651,44.88353215,-63.511239223,44.883478511,-63.5110421,44.883340078,-63.510961335,44.883282054,-63.51092987,44.883255839,-63.510910861,44.883230934,-63.510892506,44.883190955,-63.510812347,44.883009086,-63.510802747,44.88297249,-63.510804296,44.882923898,-63.510687933,44.883041808,-63.510805401,44.883275341,-63.51081841,44.883296868,-63.510836851,44.883312892,-63.510952665,44.883397298,-63.511170025,44.883557617,-63.511199734,44.883577286,-63.511224225,44.88359013,-63.511545644,44.883751197,-63.511895146,44.883927382))
axy MDSYS.SDO_GEOMETRY(2003,8307,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1),MDSYS.SDO_ORDINATE_ARRAY(-63.518193562,44.878400883,-63.518170639,44.878424027,-63.51732663,44.879276283,-63.517306365,44.879305756,-63.517302882,44.879339193,-63.517307944,44.879370666,-63.517313567,44.879396826,-63.517331081,44.879425327,-63.517352059,44.879449059,-63.517529907,44.879536473,-63.517450676,44.87944834,-63.517428804,44.879421979,-63.51741049,44.879399976,-63.517401953,44.879376169,-63.517411281,44.879350954,-63.517430699,44.879327567,-63.518392524,44.878351357,-63.518193562,44.878400883))

On 11.2.0.2 I'm getting disjoint too. Must've been fixed between 11.2.0.1 and 11.2.0.2
Cheers,
Stefan

Similar Messages

  • Please reply: Why are indices not supported in sdo_geom.relate?

    Hi,
    I read somewhere in the newsgroup that the spatial indicesa re
    used in the sdo_relate operator but not in the sdo_geom.relate
    function. Could someone please let me know why this difference?
    Thanks,
    Hemant.R

    Hi,
    The SDO_GEOM.RELATE function should be used when comparing a
    small number of geometries geometries with an area-of-interest.
    The SDO_RELATE operator should be used when comparing an
    area-of-interest with a layer, and it will use the index on the
    layer.
    There are reasons why the SDO_GEOM.RELATE function exists. If
    you have two geometries that were created as part of an
    application, however they aren't stored in a table and neither
    one is indexed, sdo_geom.relate is a convenient way of testing or
    determining what the relationship is between the geometries.
    Regarding the SDO_LEVEL you are using for indexing - 17 seems
    pretty high, and it might take a long time to create an index at
    level 17 using geometries the size of states - you might want to
    try increasing the SDO_LEVEL from 8 to 10 and see if that makes a
    difference before going higher.
    One thing you can do is look at the geometries using Spatial
    Index Advisor - you can also see the fixed size tiles and do some
    queries to get a sense of the amount of work being done by the
    index as well as the work being done in the relate portion of the
    operator.
    Hope this helps,
    Dan

  • How to use SDO_GEOM.WITHIN_DISTANCE with a geodetic CRS and degree as unit?

    Hi,
    I am trying to use SDO_GEOM.WITHIN_DISTANCE on geodetic data, but I don't want to use meter as unit for the tolerance. I thought I simply can set the unit to 'Degree', but this does not work:
    select SDO_GEOM.WITHIN_DISTANCE(
    MDSYS.SDO_GEOMETRY('POINT(0 0)', 4326),
    +11,+
    MDSYS.SDO_GEOMETRY('POINT(0 10)', 4326),
    +0.00000000005,+
    +'unit=Degree') from dual;+
    ORA-13291: conversion error between the specified unit and standard unit
    ORA-06512: at "MDSYS.SDO_3GL", line 985
    ORA-06512: at "MDSYS.SDO_GEOM", line 1034
    ORA-06512: at "MDSYS.SDO_GEOM", line 1049
    ORA-06512: at line 1
    +13291. 00000 - "conversion error between the specified unit and standard unit"+
    *Cause:    Cannot convert the specified unit from/to standard unit+
    for linear distance, angle, or area.
    *Action:   Check the unit specification and respecify it.+
    What am I doing wrong?
    Update: How is the specified unit used? Is WITHIN_DISTANCE trying to convert my 10 degree into a meter value? Because then I would understand why it is not working.
    Thanks,
    Tobias
    Edited by: tsauerwein on May 19, 2010 11:23 PM

    HI Tobias,
    "Degree" is an angle unit, not a distance unit of measurement. For within_distance operations you must use a valid distance unit, which are defined in sdo_dist_units view.
    if you indeed want to represent a distance unit in "decimal degree", you may try to define one for that by yourself.
    regards
    Jeffrey

  • SDO_GEOM.RELATE in 8.1.7

    I got 'UNKNOWN MASK: 110110001' returned when I used SDO_GEOM.RELATE function to check if 2 mutiplelinstrings are equal or not..
    Even I tried to test this function with same geometry, I still got same error message.
    BTW, for other geometry like simple polygon, this function works well.
    Any suggestions?
    Many thanks for your comments and help!
    Jack
    DECLARE
    v_GEOM1                     MDSYS.SDO_GEOMETRY;
    v_GEOM2                     MDSYS.SDO_GEOMETRY;
    v_info                              VARCHAR2(80) ;
    BEGIN
    v_GEOM1:=MDSYS.SDO_GEOMETRY(2006,NULL, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1,11,2,1),
    MDSYS.SDO_ORDINATE_ARRAY(8.07280413276778,53.62639558,8.07354916666667,53.6255908333333,
    8.07360805555555,53.6255119444444,8.07365694444444,53.6254511111111,
    8.073735,53.6253663888889,8.07253709607513,53.62639558,8.07276694444444,
    53.6261461111111,8.07306055555556,53.6258655555556,8.073735,53.6253663888889,
    8.07395,53.6251330555556,8.074015,53.6250625,8.07409694444445,53.6249738888889,
    8.07414888888889,53.6249175,8.07421555555556,53.6248452777778,8.07446527777778,
    53.6245747222222,8.07461333333333,53.6244141666667,8.07469027777778,
    53.6243308333333,8.07517888888889,53.6238011111111));     
    v_GEOM2:=MDSYS.SDO_GEOMETRY(2003, NULL, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1, 1003, 1),
    MDSYS.SDO_ORDINATE_ARRAY(8.07109464, 53.62356679, 8.07674003, 53.62356679, 8.07674003, 53.62639558,
    8.07109464, 53.62639558, 8.07109464, 53.62356679));
    SELECT MDSYS.SDO_GEOM.RELATE(v_GEOM1,'EQUAL', v_GEOM1,0.000000000001) INTO v_info FROM DUAL;          
    DBMS_OUTPUT.PUT_LINE(v_info);
    END;

    Handle:  dee
    Status Level:  Newbie (5)
    Registered:  Jun 14, 2010
    Total Posts:  61
    Total Questions:  30 (30 unresolved)
    If its working , Please mark thread as answered why you leave your thread in Open Status

  • Problem with SDO_GEOM.SDO_AREA

    I am trying to calculate all citys where the area of the citys polygon(SDO_GEOM.SDO_AREA) is 15% greater than the area of the citys in the sq_mile table. Basically the table has a attribute called sq_mile which is the area in sq_miles of the city, but they are not the same as SDO_AREA so i want to find all citys where SDO_AREA > 1.15*sq_mile
    Im not sure how to do this but these commands give both the data we need.
    SELECT SDO_GEOM.SDO_AREA(geom,1,'unit=sq_mile')
    FROM spatial.world_countries
    ORDER BY cntry_name;
    SELECT sqmi_cntry FROM spatial.world_countries ORDER BY cntry_name asc;
    Im not sure how to select it so that (SELECT SDO_GEOM.SDO_AREA(geom,1,'unit=sq_mile')
    FROM spatial.world_countries
    ORDER BY cntry_name) is GREATER than 1.15 * (SELECT sqmi_cntry FROM spatial.world_countries ORDER BY cntry_name asc)
    Any ideas please ??

    Nevermind got it,
    SELECT cntry_name AS Country
    FROM (SELECT cntry_name,sqmi_cntry sqmi,SDO_GEOM.SDO_AREA(geom,1,'unit=sq_mile') area FROM spatial.world_countries ORDER BY cntry_name ASC)
    WHERE area > 1.15*sqmi;
    Is that efficient ?? any other things i could change to make it faster ??

  • How to realize the function like SDO_GEOM.SDO_BUFFER in Spatial Operators?

    Dear all,
    I wanted to use SDO_GEOM.SDO_BUFFER function to generate a
    buffer polygon around a geometry object while it is pretty slow
    to perform for a large spatial database. I think it better
    to use Spatial Operators for it takes advantage of spatial index.
    But within operators, there are no availble function. Can anyone
    tell me how to do it with Spatial Operators?
    Thanks a lot,
    Fan

    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

  • SQL Developer 3.0.04 - SDO_GEOM Issues

    1. Performing a "SELECT *" on an Oracle table with a SDO_GEOMETRY column locks up the tool and I have to use Task Manager to can it.
    2. Clicking the Data tab on a table with an SDO_GEOM col either locks up the tool, or it takes forever to return.
    3. Performing a "SELECT" of a SDO_GEOM col either locks up the tool or takes forever to return.
    None of these issues occur in Toad.
    Edited by: JB on Jan 25, 2012 12:41 PM

    Hi,
    As Raghu noted above, and you also saw in rp0428's following reply,
    Re: Problem with displaying sdo_geometry objects
    drilling down to the cell edit details is your only recourse for now. Apparently there will be further work done in this area, but it is not clear exactly what or when it will be. For those with access to it, here is a bug reference:
    Bug 13680849 - RC1: NOT DISPLAYING THE DATA OF MDSYS.SDO_GEOMETRY
    Regards,
    Gary

  • Can you explain SDO_RELATE and SDO_GEOM.RELATE differences?

    Ok, so I'm doing some spatial queries identifying geometries that interact with each other, and everything's groovy until the customer says, ok, get rid of the ones that just touch, which means that a call to SDO_RELATE with an ANYINTERACT mask no longer does the trick. First we tried setting a multiple mask and those queries ran like 9 hours. I figured that since we're burning that much time, we might as well build a table that stores the interaction as identified by DO_GEOM.RELATE with a DETERMINE mask.
    Then I noticed an odd thing happening on the way to the forum. For some geometries I get SDO_RELATE with ANYINTERACT returning TRUE and then SDO_GEOM.RELATE returns DISJOINT with the same tolerance that is coded in the metadata (0.5). When tolerance is bumped up to 27, I get TOUCH back. The funny thing is that there are 3 geometries involved here, the reference geom, one that yields TOUCH, and the one that yields DISJOINT.
    Stepping back from this behavior, doing some head-scratching and chin-stroking, I ran accross this statement in the Oracle® Spatial User's Guide and Reference 10g Release 2 (10.2) [here.|http://download.oracle.com/docs/html/B14255_01/sdo_operat.htm#i78531]
    Unlike with the SDO_GEOM.RELATE function, DISJOINT and DETERMINE masks are not allowed in the relationship mask with the SDO_RELATE operator. This is because SDO_RELATE uses the spatial index to find candidates that may interact, and the information to satisfy DISJOINT or DETERMINE is not present in the index.
    Now, how can a function that cannot determine DISJOINT relationships be reliable in determining ANYINTERACT relationships? Actually in this case, the answer we needed is given by SDO_RELATE, as we were looking for a touch relationship for all 3 geometries, except we got the DISJOINT with the SDO_GEOM.RELATE until we cranked up the tolerance.
    These are the geometries involved:
    Base geom:
    SDO_GEOMETRY(2003, 8265, NULL), SDO_ELEM_INFO_ARRAY( 1, 1003, 1), SDO_ORDINATE_ARRAY( -81.9497222222222, 32.0836111111111, -82.2163888888889, 31.7502777777778, -81.9997222222222, 31.4002777777778, -81.9997222222222, 31.8502777777778, -81.9497222222222, 32.0836111111111))
    Geom that yields ANYINTERACT and TOUCH:
    SDO_GEOMETRY(2003, 8265, NULL), SDO_ELEM_INFO_ARRAY( 1, 1003, 1), SDO_ORDINATE_ARRAY( -81.77888889, 31.3330555608386, -81.59972222, 31.4252777808399, -81.99972222, 31.7997222208455, -81.99972222, 31.4002777808396, -81.88777778, 31.3330555608386, -81.77888889, 31.3330555608386))
    Geom that yields ANYINTERACT and DISJOINT:
    SDO_GEOMETRY(2003, 8265, NULL), SDO_ELEM_INFO_ARRAY( 1, 1003, 1), SDO_ORDINATE_ARRAY( -81.39166667, 31.6836111108438, -81.34972222, 31.8502777808462, -81.99972222, 31.8500000008462, -81.99972222, 31.7997222208455, -81.59972222, 31.4252777808399, -81.52472222, 31.4377777808401, -81.45805556, 31.5419444408417, -81.47055556, 31.6252777808429, -81.39166667, 31.6836111108438))
    Both should touch the base geom along the -81.99972222 or at least both should be disjoint at a tolerance of 0.5 but one is and the other isn't.
    So how do I know when to trust SDO_RELATE? How do I know what tolerance will give me consistency?
    Oh, yeah, we have the query down to about 45 mins, by using SDO_GEOM.RELATE with DETERMINE and SDO_FILTER in the where clause. (comparing each geometry to each geometry in a table of about 10K rows)

    ConSolTed,
    It looks to me like the geometries in question are disjoint by 0.000247 meters.
    Check my math:
    -81.9997222222222 - -81.99972222 = -0.0000000022222 degrees
    111,000 meters/degree @equator * -0.0000000022222 * cos(31.4) = -0.000247
    So I would expect sdo_geom.relate to return TOUCH for both geometries, and sdo_anyinteract to return TRUE for both, when the tolerance is around .0005 and up. But I've never been good at this math stuff.
    Anyone know why ConSolTed's query below, now with a tolerance of 26 meters, returns Disjoint?
    SQL> select version from v$instance;
    VERSION
    10.2.0.4.0
    SQL> SELECT
    2 SDO_GEOM.RELATE(
    3 SDO_GEOMETRY(2003, 8265, NULL, SDO_ELEM_INFO_ARRAY( 1, 1003, 1), SDO_ORDINATE_ARRAY( -81.9497
    222222222, 32.0836111111111, -82.2163888888889, 31.7502777777778, -81.9997222222222, 31.400277777777
    8, -81.9997222222222, 31.8502777777778, -81.9497222222222, 32.0836111111111))
    4 , 'determine',
    5 SDO_GEOMETRY(2003, 8265, NULL, SDO_ELEM_INFO_ARRAY( 1, 1003, 1), SDO_ORDINATE_ARRAY( -81.391666
    67, 31.6836111108438, -81.34972222, 31.8502777808462, -81.99972222, 31.8500000008462, -81.99972222,
    31.7997222208455, -81.59972222, 31.4252777808399, -81.52472222, 31.4377777808401, -81.45805556, 31.5
    419444408417, -81.47055556, 31.6252777808429, -81.39166667, 31.6836111108438))
    6 , 26) relationship
    7 FROM dual;
    RELATIONSHIP
    DISJOINT

  • SDO_RELATE AND SDO_GEOM RELATE MASK PROBLEMS

    I am trying to use the SDO_RELATE operator on my spatial table.
    I have been experiencing problems.
    I also get the same problems if I use the SDO_GEOM.RELATE geometry function.
    Background
    Table2 contains about 20 000 rows.
    Table1 contains about 1 000 000 rows.
    Both tables contain area geomteries.
    I can not get the following 'masks' to return any results.
    -- OVERLAPBDYINTERSECT
    -- COVEREDBY
    -- COVERS
    -- OVERLAPBDYDISJOINT
    The all return -
    ERROR at line 1:
    ORA-03113: end-of-file on communication channel
    Elapsed: 00:00:20.00
    However the mask INSIDE does work!!! And it returns the correct results.
    The query syntax I am using is below. And substituting any of the above mentioned masks for INSIDE results in the ORA-03113 error.
    I have validated all the geometies in my table using SDO_GEOM.VALIDATE_LAYER. They are all valid.
    Query Syntax
    SELECT /* ORDERED */ count(g2.parcel_ref)
    FROM table2 g2
    WHERE 1 < (SELECT /*+ ORDERED */ count(*)
    FROM table1 g1
    WHERE SDO_RELATE (g1.geometry,
         g2.geom,
              'MASK=INSIDE querytype=WINDOW') ='TRUE');
    SELECT /* ORDERED ORDERED_PREDICATES */ count(g2.parcel_ref)
    FROM table2 g2
    WHERE 1 < (SELECT /*+ ORDERED */ count(*)
    FROM table1 g1
    WHERE SDO_FILTER (g1.geometry, g2.geom, 'querytype=WINDOW')='TRUE'
    AND SDO_GEOM.RELATE (g1.geometry, 'inside', g2.geom,0.001)='INSIDE');
    Does anybody have any ideas why all the masks (except INSIDE) fail?
    Thanks,
    Bob

    Dan,
    I have finally got back to looking at my problem queries.
    The first discovery I have found is that I can repeat the problem using one feature in one of the geometry tables.
    You can see the syntax that I am using below. As I stated before, the INDSIDE query works, but the COVEREDBY fails.
    OVERLAPBDYINTERSECT,COVEREDBY,COVERS,OVERLAPBDYDISJOINT also return the same ORA-03113 error.
    SELECT /* ORDERED */ count(g2.parcel_ref)
    FROM table2 g2
    WHERE g2.id = 3658
    AND 1 < (SELECT /*+ ORDERED */ count(*)
    FROM table1 g1
    WHERE SDO_RELATE (g1.geometry, g2.geom, 'MASK=INSIDE querytype=WINDOW') ='TRUE');
    *** THIS ONE WORKS!
    SELECT /* ORDERED */ count(g2.parcel_ref)
    FROM table2 g2
    WHERE g2.id = 3658
    AND 1 < (SELECT /*+ ORDERED */ count(*)
    FROM table1 g1
    WHERE SDO_RELATE (g1.geometry, g2.geom, 'MASK=COVEREDBY querytype=WINDOW') ='TRUE');
    *** THIS ONE DOES NOT WORK! The error is below.
    SELECT /* ORDERED */ count(g2.parcel_ref)
    ERROR at line 1:
    ORA-03113: end-of-file on communication channel
    I have also been running some other queries on my data.
    Again, one query works, the other does not.
    SELECT /*+ ORDERED ORDERED_PREDICATES */ count(*)
    FROM table2 g1, table2 g2
    WHERE g1.id = 194
    AND SDO_FILTER (g2.geom, g1.geom, 'querytype=WINDOW')='TRUE'
    AND SDO_GEOM.RELATE (g2.geom, 'overlapbdyintersect', g1.geom,0.0001)='OVERLAPBDYINTERSECT';
    *** THIS ONE WORKS!
    SELECT /*+ ORDERED */ count(*)
    FROM table2 g1, table2 g2
    WHERE g1.id = 194
    AND SDO_RELATE (g2.geom, g1.geom, 'MASK=OVERLAPBDYINTERSECT querytype=WINDOW') ='TRUE';
    *** THIS ONE DOES NOT WORK! Again, the error is below.
    SELECT /*+ ORDERED */ count(*)
    ERROR at line 1:
    ORA-03113: end-of-file on communication channel
    I have checked that the two problem geometries are 'valid'.
    SQL> select sdo_geom.validate_geometry(geom, 0.001) from table2 where id=194;
    SDO_GEOM.VALIDATE_GEOMETRY(GEOM,0.001)
    TRUE
    SQL> select sdo_geom.validate_geometry(geom, 0.001) from table2 where id=3658;
    SDO_GEOM.VALIDATE_GEOMETRY(GEOM,0.001)
    TRUE
    Below is a print of the geometry of each of the problem features.
    Have you got any ideas as to why the queries are failing?
    Thanks in advance,
    Bob
    SQL> select geom from sample_lr_prm_iacs2002 where id=3658;
    GEOM(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
    SDO_GEOMETRY(2003, 81989, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1), SDO_ORDINATE_AR
    RAY(475710.144, 133881.126, 475714.379, 133844.065, 475723.656, 133762.89, 47572
    4.07, 133759.271, 475964.952, 133791.345, 475963, 133796.9, 475959, 133806.2, 47
    5956.8, 133812.5, 475955.2, 133816.1, 475951.3, 133824.1, 475944.3, 133838.6, 47
    5933.5, 133861.8, 475932, 133864.5, 475928.5, 133869.7, 475918.8, 133885.8, 4759
    12.5, 133897, 475907.6, 133903.9, 475898.6, 133914.2, 475888.8, 133922.7, 475824
    .2, 133974.3, 475809.9, 133976.2, 475808.1, 133974.6, 475805.5, 133972, 475796.3
    , 133955.7, 475783.99, 133933.51, 475782.67, 133931.44, 475780.87, 133927.97, 47
    5780.14, 133927, 475778.95, 133924.69, 475778.12, 133923.03, 475775.33, 133919.3
    4, 475773.51, 133917.39, 475768.42, 133913.14, 475765.56, 133911.12, 475757.25,
    133906.26, 475751.77, 133903.28, 475741.52, 133897.2, 475714.92, 133883.62, 4757
    GEOM(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
    10.86, 133881.5, 475710.144, 133881.126))
    SQL> select geom from table2 where id=194;
    GEOM(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
    SDO_GEOMETRY(2003, 81989, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1), SDO_ORDINATE_AR
    RAY(467345.544, 109699.287, 467345.379, 109699.279, 467345.288, 109698.752, 4673
    44.9, 109696.5, 467339.8, 109665.2, 467325.9, 109583.1, 467311.35, 109500, 46730
    9.1, 109487, 467308.27, 109482.113, 467308.242, 109482.142, 467307.491, 109478.1
    99, 467307.44, 109477.435, 467307.3, 109475.9, 467307.331, 109475.837, 467307.02
    4, 109471.295, 467306.963, 109471.307, 467306.831, 109471.334, 467306.831, 10946
    9.765, 467307.192, 109469.68, 467310.196, 109468.973, 467345.545, 109459.288, 46
    7363.626, 109453.84, 467395.576, 109447.4, 467444.616, 109440.217, 467457.247, 1
    09439.474, 467460.715, 109437.245, 467461.458, 109436.255, 467467.251, 109435.39
    6, 467468.145, 109435.264, 467468.264, 109435.663, 467481.7, 109435.2, 467487.2,
    109435.3, 467488.8, 109435.4, 467490.6, 109435.5, 467493.4, 109435.9, 467495.6,
    GEOM(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
    109435.9, 467500, 109435.8, 467505.75, 109435.8, 467515.85, 109436.2, 467525.2,
    109436.45, 467531.95, 109436.5, 467534.7, 109436.55, 467541.45, 109436.8, 46754
    4.65, 109437.05, 467547.65, 109437.3, 467551.3, 109437.7, 467551.95, 109437.75,
    467555.6, 109438.1, 467556.4, 109438.15, 467558.6, 109438.25, 467562.95, 109438.
    35, 467585.5, 109439.1, 467593.55, 109439.35, 467597.5, 109439.35, 467600.45, 10
    9439.3, 467603.65, 109439.35, 467606.8, 109439.3, 467607, 109439.3, 467610.15, 1
    09439.2, 467613.35, 109439, 467615.7, 109438.8, 467618, 109438.55, 467620.3, 109
    438.25, 467623.3, 109437.65, 467626.2, 109437.1, 467626.85, 109437, 467629.8, 10
    9436.5, 467631.6, 109436.25, 467634.15, 109435.95, 467635.05, 109435.85, 467636.
    95, 109435.7, 467637.35, 109435.65, 467639.25, 109435.4, 467640.1, 109435.25, 46
    7641, 109435.1, 467643.7, 109434.5, 467644.3, 109434.3, 467652.15, 109432.45, 46
    GEOM(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
    7653.35, 109432.2, 467654.4, 109431.95, 467656.8, 109431.25, 467658.35, 109430.7
    5, 467659.75, 109430.15, 467660, 109430.05, 467662.95, 109429.15, 467667.25, 109
    427.9, 467667.8, 109427.8, 467668.5, 109427.7, 467670, 109427.5, 467670.7, 10942
    7.4, 467671.45, 109427.35, 467671.7, 109427.35, 467678.95, 109427.45, 467680.4,
    109427.5, 467681.75, 109427.55, 467683.2, 109427.55, 467684.55, 109427.5, 467685
    .95, 109427.45, 467687.35, 109427.35, 467688.55, 109427.25, 467695.4, 109426.55,
    467696.8, 109426.45, 467698.15, 109426.3, 467699.55, 109426.1, 467700.75, 10942
    5.95, 467703.45, 109425.35, 467703.95, 109425.2, 467708.85, 109423.95, 467717.8,
    109421.4, 467721.2, 109420.5, 467726.4, 109419.2, 467729.8, 109418.5, 467731.45
    , 109418.15, 467735.95, 109417.45, 467737.5, 109417.25, 467742.8, 109417.05, 467
    748.2, 109416.7, 467748.95, 109416.6, 467749.7, 109416.45, 467750.5, 109416.3, 4
    GEOM(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
    67752, 109415.9, 467752.75, 109415.65, 467753.4, 109415.45, 467753.95, 109415.2,
    467754.55, 109415, 467755.1, 109414.75, 467755.6, 109414.45, 467756.15, 109414.
    2, 467756.45, 109414, 467762.25, 109409.8, 467768.8, 109404.9, 467770.4, 109403.
    7, 467771.3, 109403.1, 467771.513, 109402.932, 467772.658, 109403.214, 467772.92
    9, 109403.281, 467777.496, 109404.803, 467790.963, 109405.789, 467804.758, 10940
    7.103, 467810.013, 109407.431, 467821.181, 109409.73, 467831.035, 109410.716, 46
    7843.188, 109412.03, 467849.757, 109412.686, 467853.992, 109414.38, 467854.15, 1
    09416.85, 467854.85, 109427.6, 467855.35, 109436.3, 467855.75, 109443.95, 467856
    .25, 109451.7, 467854.7, 109460.35, 467852.45, 109472, 467850.5, 109482.45, 4678
    48.45, 109493.25, 467847.15, 109500, 467846.25, 109505.2, 467845, 109511.7, 4678
    44.25, 109515.9, 467843.15, 109521.5, 467841.85, 109528.55, 467840.65, 109534.95
    GEOM(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
    , 467840.05, 109538.2, 467839.65, 109542.4, 467839.05, 109548.35, 467838.55, 109
    553.6, 467837.9, 109560.6, 467837.2, 109568, 467836.45, 109576.3, 467836.05, 109
    581.45, 467835.45, 109588.4, 467834.55, 109597.9, 467833.1, 109614.5, 467832.35,
    109622, 467831.2, 109634.4, 467830.6, 109640.2, 467830.55, 109640.5, 467828.5,
    109642.15, 467824.2, 109642.3, 467821.1, 109642.35, 467819.75, 109642.4, 467818.
    9, 109642.4, 467818.6, 109642.45, 467818.4, 109642.45, 467818.25, 109642.5, 4678
    18.05, 109642.5, 467817.85, 109642.55, 467817.65, 109642.5, 467817.45, 109642.5,
    467817.2, 109642.55, 467816.95, 109642.55, 467816.7, 109642.6, 467816.45, 10964
    2.6, 467815.85, 109642.7, 467815.35, 109642.7, 467814.65, 109642.8, 467812.25, 1
    09643.05, 467811.4, 109643.1, 467810.55, 109643.2, 467809.1, 109643.4, 467807.1,
    109643.7, 467805.75, 109643.85, 467804.45, 109643.95, 467800.55, 109644.5, 4677
    GEOM(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
    98.75, 109644.7, 467795.9, 109645, 467794.95, 109645.15, 467793.6, 109645.3, 467
    792.15, 109645.55, 467790.65, 109645.75, 467787.25, 109646.05, 467782.8, 109646.
    5, 467778.15, 109646.95, 467774.5, 109647.4, 467770.1, 109647.85, 467765.75, 109
    648.3, 467760.85, 109648.9, 467753.35, 109649.65, 467748.7, 109650.1, 467745.15,
    109650.45, 467741.05, 109650.85, 467739.95, 109650.95, 467736.45, 109651.35, 46
    7732.1, 109651.95, 467729.1, 109652.3, 467724.95, 109652.7, 467723.05, 109652.95
    , 467720.5, 109653.2, 467716.65, 109653.75, 467712.05, 109654.45, 467708.65, 109
    654.9, 467704.45, 109655.4, 467700.35, 109655.95, 467695.65, 109656.65, 467692.4
    , 109657.1, 467690.4, 109657.25, 467682.65, 109657.8, 467679, 109658.1, 467676.1
    5, 109658.35, 467674.75, 109658.5, 467674.3, 109658.5, 467674.1, 109658.55, 4676
    73.7, 109658.55, 467673.3, 109658.65, 467673, 109658.7, 467672.7, 109658.8, 4676
    GEOM(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
    72.1, 109658.9, 467671.4, 109659, 467670.9, 109659.1, 467670, 109659.25, 467669.
    75, 109659.3, 467668.75, 109659.4, 467668.3, 109659.4, 467667.85, 109659.45, 467
    665.4, 109659.65, 467661.9, 109660.05, 467659.5, 109660.3, 467656.65, 109660.7,
    467652.55, 109661.25, 467648.35, 109661.8, 467644.65, 109662.25, 467641.7, 10966
    2.65, 467639.5, 109662.9, 467636.75, 109663.25, 467633.25, 109663.6, 467631.7, 1
    09663.75, 467631.5, 109663.8, 467631.1, 109663.8, 467630.9, 109663.85, 467630.55
    , 109663.85, 467630.35, 109663.9, 467630.2, 109663.95, 467629.85, 109663.95, 467
    629.05, 109664.05, 467628.35, 109664.15, 467628.05, 109664.2, 467627.7, 109664.3
    , 467625.95, 109664.55, 467623.15, 109665.1, 467622.85, 109665.15, 467622.6, 109
    665.25, 467622.3, 109665.3, 467622.05, 109665.35, 467621.9, 109665.35, 467621.65
    , 109665.4, 467621.4, 109665.4, 467621.15, 109665.45, 467620.95, 109665.5, 46762
    GEOM(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
    0.7, 109665.6, 467620.5, 109665.65, 467620.3, 109665.65, 467619.8, 109665.75, 46
    7619.5, 109665.8, 467619.15, 109665.8, 467618.45, 109665.9, 467616.8, 109666.1,
    467613.2, 109666.6, 467610.15, 109667.05, 467608, 109667.3, 467605.85, 109667.5,
    467603.75, 109667.7, 467602.25, 109667.9, 467601.05, 109668, 467597.05, 109668.
    35, 467592.6, 109668.8, 467589.7, 109669.1, 467587.1, 109669.4, 467583.65, 10966
    9.75, 467580.7, 109670.1, 467576.3, 109670.65, 467567, 109671.85, 467562.25, 109
    672.4, 467556.85, 109673, 467553.95, 109673.3, 467550.35, 109671.95, 467545.1, 1
    09670, 467540.35, 109668.3, 467539.9, 109668.15, 467539.75, 109668.15, 467539.6,
    109668.1, 467539.5, 109668.05, 467539.35, 109668, 467539.2, 109668, 467539, 109
    667.95, 467538.75, 109667.95, 467538.55, 109667.9, 467538.35, 109667.9, 467534.8
    , 109667.7, 467530.65, 109667.35, 467523.9, 109666.75, 467519.5, 109666.4, 46751
    GEOM(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
    6.2, 109666.1, 467511.8, 109665.65, 467508.1, 109665.3, 467504.85, 109664.9, 467
    501.35, 109664.5, 467500, 109664.4, 467498.7, 109664.3, 467480.5, 109673.4, 4674
    73.7, 109677, 467468.4, 109680, 467461.5, 109683.8, 467453.2, 109688.1, 467448.1
    , 109690.4, 467441.4, 109693, 467439.6, 109693.6, 467430, 109696.2, 467424, 1096
    97.7, 467420.3, 109698.5, 467419.444, 109698.653, 467419.409, 109698.708, 467397
    .983, 109702.395, 467373.562, 109709.767, 467362.964, 109719.213, 467362.94, 109
    718.668, 467362.504, 109719.213, 467347.528, 109705.39, 467346.459, 109701.945,
    467346.01, 109700.498, 467345.636, 109699.291, 467345.544, 109699.287))

  • Inconsistent results between SDO_RELATE and SDO_GEOM.RELATE

    Maybe its the Friday syndrome, but I'm getting some results that I can't get my head around...
    Let say I have a table with a single line geometry...
    CREATE TABLE BUFFER_TEST (
         WHAT VARCHAR2(100),
         GEOMETRY SDO_GEOMETRY);
    INSERT INTO user_sdo_geom_metadata VALUES ('BUFFER_TEST','GEOMETRY', 
    MDSYS.SDO_DIM_ARRAY(
         MDSYS.SDO_DIM_ELEMENT('X',400000,750000,0.0005),
         MDSYS.SDO_DIM_ELEMENT('Y',500000,1000000,0.0005)),
    262152);
    CREATE INDEX BUFFER_TEST_IDX ON BUFFER_TEST (GEOMETRY) INDEXTYPE IS MDSYS.SPATIAL_INDEX;
    INSERT INTO BUFFER_TEST (what, geometry)
    VALUES ('line',
    SDO_GEOMETRY(2002, 262152, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1),
    SDO_ORDINATE_ARRAY(713353.165, 736165.812, 713353.449, 736165.402, 713353.849,
    736164.203, 713353.85, 736162.252, 713353.087, 736149.092)));
    COMMIT;Now I want to buffer this line and check if the line is inside the buffer - the actual business need is to see if other lines are in the buffer, but we'll keep it simple for now...
    So in the snippet below, I'm buffering the line by 50cm and then using SDO_INSIDE to see if the line is inside the buffer - it isn't.
    Then if I use SDO_GEOM.RELATE to determine the relationship, it says INSIDE, which is correct.
    Then if I increase the buffer size to 1m, then SDO_INSIDE and SDO_GEOM.RELATE both return the correct result.
    SQL> DECLARE
      2   l_inside  NUMBER;
      3   l_small_buffer SDO_GEOMETRY;
      4   l_determine  VARCHAR2(100);
      5   l_buffer_size  NUMBER := 0.5;
      6  BEGIN
      7
      8     SELECT  SDO_GEOM.SDO_BUFFER(b.geometry, usgm.diminfo, l_buffer_size)
      9     INTO      l_small_buffer
    10     FROM    user_sdo_geom_metadata usgm, BUFFER_TEST b
    11     WHERE  usgm.table_name = 'BUFFER_TEST'
    12     AND      usgm.column_name = 'GEOMETRY'
    13     AND      b.what = 'line';
    14
    15     SELECT  COUNT(*)
    16     INTO    l_inside
    17     FROM   BUFFER_TEST
    18     WHERE SDO_INSIDE(geometry, l_small_buffer) = 'TRUE'
    19     AND     what = 'line';
    20
    21     SELECT SDO_GEOM.RELATE(geometry, 'determine', l_small_buffer, 0.0005) relationship
    22     INTO  l_determine
    23     FROM BUFFER_TEST
    24     WHERE what = 'line';
    25
    26     DBMS_OUTPUT.PUT_LINE('l_inside: ' || l_inside || ' relationship ' || l_determine);
    27
    28  END;
    29  /
    l_inside: 0 relationship INSIDEAny help would be much appreciated... I'm starting to pull my hair out on this.
    This is on Oracle 10.2.0.3

    I can reproduce this on 11.1.0.6 on Windows 32bit.
    Would you recommend I open a support case on this? Do you think it would be possible to backport a fix to 10.2.0.4?

  • Bug in function mdsys.sdo_geom.sdo_intersection() ?

    Hi,
    I got a strange result from the spatial subprogram
    SDO_GEOM.SDO_INTERSECTION(
    geom1 IN SDO_GEOMETRY,
    dim1 IN SDO_DIM_ARRAY,
    geom2 IN SDO_GEOMETRY,
    dim2 IN SDO_DIM_ARRAY
    ) RETURN SDO_GEOMETRY;
    I’m calling the function three times, passing each time the same geom1 and geom2 parameters. What changes it the value of the tolerance. Depending on the tolerance, sdo_intersection returns null or a valid geometry
    tol = 0.02 --> the resulting geometry is correct
    tol = 0.01 --> returns null !
    tol = 0.005 --> the resulting geometry is correct
    Please note that the result is null only for a tolerance in the range between 0.005 and 0.02 but not below or above these values.
    I suppose this is a bug in sdo_intersection.
    The exact query is:
    select mdsys.sdo_geom.sdo_intersection(
    (select A1.geoloc AS G1 from A1 where A1.mi_prinx = 390),
    (select m.diminfo AS diminfo_1 from user_sdo_geom_metadata m where m.table_name = 'A1'),
    (select A2.geoloc AS G2 from A2 where A2.mi_prinx = 245),
    (select m.diminfo AS diminfo_2 from user_sdo_geom_metadata m where m.table_name = 'A2')
    from dual;
    The metadata is changed using this query:
    update mdsys.user_sdo_geom_metadata
    set diminfo =
    SDO_DIM_ARRAY(SDO_DIM_ELEMENT('X', 650000, 800000, .01),
    SDO_DIM_ELEMENT('Y', 180000, 300000, .01))
    where table_name IN ( 'A1', 'A2');
    Here are the geometries:
    geom1:
    SDO_GEOMETRY(2003, 262148, SDO_POINT_TYPE(758105.191, 245133.936, NULL), SDO_ELEM_INFO_ARRAY(1, 1003, 1), SDO_ORDINATE_ARRAY(758052.231, 245053.334, 758069.068, 245067.151, 758086.21, 245078.671, 758103.848, 245088.516, 758129.333, 245101.44, 758233.145, 245178.636, 758224.249, 245202.49, 758201.602, 245194.226, 758194.164, 245214.538, 758096.977, 245178.816, 758091.076, 245194.648, 758026.177, 245181.097, 758008.793, 245172.515, 757977.236, 245143.726, 758052.231, 245053.334))
    geom2:
    SDO_GEOMETRY(2003, 262148, SDO_POINT_TYPE(758042.484, 245106.878, NULL), SDO_ELEM_INFO_ARRAY(1, 1003, 1), SDO_ORDINATE_ARRAY(758129.32, 245101.47, 758233.14, 245178.66, 758224.242, 245202.514, 758211.122, 245237.717, 758166.209, 245208.415, 758091.065, 245194.675, 758026.168, 245181.127, 758008.785, 245172.546, 757977.231, 245143.76, 757932.238, 245109.93, 757895.471, 245068.865, 757851.827, 245034.324, 757941.369, 244976.447, 757951, 244976.04, 757960.491, 244979.747, 757992.773, 244998.626, 758005.407, 245007.133, 758026.492, 245029.014, 758052.22, 245053.37, 758069.056, 245067.186, 758086.197, 245078.704, 758103.835, 245088.548, 758129.32, 245101.47))

    I have tried to replicate your dataset (see below) and then I have execute the same query on the two tables and on metadata table, but the query still runs OK ... !
    a doubt: are you sure that the sdo_ordinates arrays stored in the tables are exactly those you include in the msg?
    Generally, the result of a "select" is truncated at the default decimal digit of sql client.
    You can try to set the NUMF parameter (SET NUMF 999999.999999) and then re-execute the query to obtain a more precise value of ordinates as data input for our test.
    Carl
    SQL> create table tab1 (idGeom varchar2(1), geom mdsys.sdo_geometry);
    Table created.
    SQL> create table tab2 (idGeom varchar2(1), geom mdsys.sdo_geometry);
    Table created.
    SQL> r
    1 insert into tab1 (idGeom,geom)
    2 values
    3 ('1',
    4 MDSYS.SDO_GEOMETRY(2003, 262148,
    5 MDSYS.SDO_POINT_TYPE(758105.191, 245133.936, NULL),
    6 MDSYS.SDO_ELEM_INFO_ARRAY(1, 1003, 1),
    7 MDSYS.SDO_ORDINATE_ARRAY(758052.231, 245053.334, 758069.068, 245067.151,
    8 758086.21, 245078.671, 758103.848, 245088.516,
    9 758129.333, 245101.44, 758233.145, 245178.636,
    10 758224.249, 245202.49, 758201.602, 245194.226,
    11 758194.164, 245214.538, 758096.977, 245178.816,
    12 758091.076, 245194.648, 758026.177, 245181.097,
    13 758008.793, 245172.515, 757977.236, 245143.726,
    14* 758052.231, 245053.334)))
    1 row created.
    SQL> r
    1 insert into tab2 (idGeom,geom)
    2 values
    3 ('2',
    4 MDSYS.SDO_GEOMETRY(2003, 262148,
    5 MDSYS.SDO_POINT_TYPE(758042.484, 245106.878, NULL),
    6 MDSYS.SDO_ELEM_INFO_ARRAY(1, 1003, 1),
    7 MDSYS.SDO_ORDINATE_ARRAY(758129.32, 245101.47, 758233.14, 245178.66,
    8 758224.242, 245202.514, 758211.122, 245237.717,
    9 758166.209, 245208.415, 758091.065, 245194.675,
    10 758026.168, 245181.127, 758008.785, 245172.546,
    11 757977.231, 245143.76, 757932.238, 245109.93,
    12 757895.471, 245068.865, 757851.827, 245034.324,
    13 757941.369, 244976.447, 757951, 244976.04,
    14 757960.491, 244979.747, 757992.773, 244998.626,
    15 758005.407, 245007.133, 758026.492, 245029.014,
    16 758052.22, 245053.37, 758069.056, 245067.186,
    17 758086.197, 245078.704, 758103.835, 245088.548,
    18* 758129.32, 245101.47)))
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> r
    1 insert into user_sdo_geom_metadata
    2 (TABLE_NAME,COLUMN_NAME,DIMINFO,SRID)
    3 values
    4 ('TAB1','GEOM',
    5 MDSYS.SDO_DIM_ARRAY(
    6 MDSYS.SDO_DIM_ELEMENT('X', 650000, 800000, .01),
    7 MDSYS.SDO_DIM_ELEMENT('Y', 180000, 300000, .01)),
    8* 262148)
    1 row created.
    SQL> r
    1 insert into user_sdo_geom_metadata
    2 (TABLE_NAME,COLUMN_NAME,DIMINFO,SRID)
    3 values
    4 ('TAB2','GEOM',
    5 MDSYS.SDO_DIM_ARRAY(
    6 MDSYS.SDO_DIM_ELEMENT('X', 650000, 800000, .01),
    7 MDSYS.SDO_DIM_ELEMENT('Y', 180000, 300000, .01)),
    8* 262148)
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> r
    1 select mdsys.sdo_geom.sdo_intersection(
    2 (select geom AS G1 from tab1 where tab1.idGeom = '1'),
    3 (select m.diminfo AS diminfo_1 from user_sdo_geom_metadata m where m.table_name = 'TAB1'),
    4 (select geom AS G2 from tab2 where tab2.idGeom = '2'),
    5 (select m.diminfo AS diminfo_1 from user_sdo_geom_metadata m where m.table_name = 'TAB2')
    6 )
    7* from dual
    MDSYS.SDO_GEOM.SDO_INTERSECTION((SELECTGEOMASG1FROMTAB1WHERETAB1.IDGEOM='1'),(SE
    SDO_GEOMETRY(2003, 262148, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1), SDO_ORDINATE_A
    RRAY(758008,793, 245172,515, 757977,236, 245143,726, 758052,22, 245053,37, 75806
    9,056, 245067,186, 758086,197, 245078,704, 758103,835, 245088,548, 758129,32, 24
    5101,47, 758233,14, 245178,66, 758224,249, 245202,49, 758201,602, 245194,226, 75
    8194,164, 245214,538, 758096,977, 245178,816, 758091,076, 245194,648, 758026,177
    , 245181,097, 758008,793, 245172,515))
    SQL> r
    1 update user_sdo_geom_metadata
    2 set diminfo =
    3 MDSYS.SDO_DIM_ARRAY(
    4 MDSYS.SDO_DIM_ELEMENT('X', 650000, 800000, .02),
    5 MDSYS.SDO_DIM_ELEMENT('Y', 180000, 300000, .02))
    6* where table_name = 'TAB1'
    1 row updated.
    SQL> r
    1 update user_sdo_geom_metadata
    2 set diminfo =
    3 MDSYS.SDO_DIM_ARRAY(
    4 MDSYS.SDO_DIM_ELEMENT('X', 650000, 800000, .02),
    5 MDSYS.SDO_DIM_ELEMENT('Y', 180000, 300000, .02))
    6* where table_name = 'TAB2'
    1 row updated.
    SQL> commit;
    Commit complete.
    SQL> select mdsys.sdo_geom.sdo_intersection(
    2 (select geom AS G1 from tab1 where tab1.idGeom = '1'),
    3 (select m.diminfo AS diminfo_1 from user_sdo_geom_metadata m where m.table_name = 'TAB1'),
    4 (select geom AS G2 from tab2 where tab2.idGeom = '2'),
    5 (select m.diminfo AS diminfo_1 from user_sdo_geom_metadata m where m.table_name = 'TAB2')
    6 )
    7 from dual;
    MDSYS.SDO_GEOM.SDO_INTERSECTION((SELECTGEOMASG1FROMTAB1WHERETAB1.IDGEOM='1'),(SE
    SDO_GEOMETRY(2003, 262148, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1), SDO_ORDINATE_A
    RRAY(758008,793, 245172,515, 757977,236, 245143,726, 758052,22, 245053,37, 75806
    9,056, 245067,186, 758086,197, 245078,704, 758103,835, 245088,548, 758129,32, 24
    5101,47, 758233,14, 245178,66, 758224,249, 245202,49, 758201,602, 245194,226, 75
    8194,164, 245214,538, 758096,977, 245178,816, 758091,076, 245194,648, 758026,177
    , 245181,097, 758008,793, 245172,515))
    SQL> r
    1 update user_sdo_geom_metadata
    2 set diminfo =
    3 MDSYS.SDO_DIM_ARRAY(
    4 MDSYS.SDO_DIM_ELEMENT('X', 650000, 800000, .005),
    5 MDSYS.SDO_DIM_ELEMENT('Y', 180000, 300000, .005))
    6* where table_name = 'TAB1'
    1 row updated.
    SQL> r
    1 update user_sdo_geom_metadata
    2 set diminfo =
    3 MDSYS.SDO_DIM_ARRAY(
    4 MDSYS.SDO_DIM_ELEMENT('X', 650000, 800000, .005),
    5 MDSYS.SDO_DIM_ELEMENT('Y', 180000, 300000, .005))
    6* where table_name = 'TAB2'
    1 row updated.
    SQL> commit;
    Commit complete.
    SQL> select mdsys.sdo_geom.sdo_intersection(
    2 (select geom AS G1 from tab1 where tab1.idGeom = '1'),
    3 (select m.diminfo AS diminfo_1 from user_sdo_geom_metadata m where m.table_name = 'TAB1'),
    4 (select geom AS G2 from tab2 where tab2.idGeom = '2'),
    5 (select m.diminfo AS diminfo_1 from user_sdo_geom_metadata m where m.table_name = 'TAB2')
    6 )
    7 from dual;
    MDSYS.SDO_GEOM.SDO_INTERSECTION((SELECTGEOMASG1FROMTAB1WHERETAB1.IDGEOM='1'),(SE
    SDO_GEOMETRY(2003, 262148, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1), SDO_ORDINATE_A
    RRAY(758008,793, 245172,515, 757977,236, 245143,726, 758052,209, 245053,36, 7580
    52,22, 245053,37, 758069,056, 245067,186, 758086,197, 245078,704, 758103,835, 24
    5088,548, 758129,32, 245101,47, 758233,14, 245178,66, 758224,249, 245202,49, 758
    201,602, 245194,226, 758194,164, 245214,538, 758096,977, 245178,816, 758091,076,
    245194,648, 758026,177, 245181,097, 758008,793, 245172,515))

  • SDO_GEOM.WITHIN_DISTANCE parameter question

    Hello,
    We are using a spatial function in our WHERE clause to determine whether Point A is within a certain distance of Point B. The call is:
    and SDO_GEOM.WITHIN_DISTANCE(s.location, 1000, n.location, 10) = 'TRUE'
    I can tell that the code is trying to see whether Point A is within 1000 units of Point B but what I'm trying to figure out what the unit of measurement is for the 1000 units. Could someone give me a pointer on where I can find the definition of this unit of measurement?
    Thanks for your time.
    Steve

    from the user guide:
    http://download.oracle.com/docs/html/B14255_01/sdo_objgeom.htm#sthref1756
    SDO_GEOM.WITHIN_DISTANCE(
         geom1 IN SDO_GEOMETRY,
         dist IN NUMBER,
         geom2 IN SDO_GEOMETRY,
         tol IN NUMBER
         [, units IN VARCHAR2]
         ) RETURN VARCHAR2; units
    Unit of measurement: a quoted string with unit= and an SDO_UNIT value from the MDSYS.SDO_AREA_UNITS table (for example, 'unit=KM'). See Section 2.8 for more information about unit of measurement specification.
    If this parameter is not specified, the unit of measurement associated with the data is assumed. For geodetic data, the default unit of measurement is meters.
    Note:
    1. that this is a function that does not use spatial index.
    did you in the where clause explictly defined pointa and pointb?
    if not, you should use the operator SDO_WITHIN_DISTANCE http://download.oracle.com/docs/html/B14255_01/sdo_operat.htm#sthref1150.
    Luc
    Edited by: lucvanlinden on Oct 1, 2008 8:26 PM

  • Sdo_geom.relate operator (urgently)

    i have got two roads features one from large scale second from small scale
    my task is to extract features of common means intersection
    i have drawn a buffer around the small scale feature
    which has two records
    NO UFI
    1 BB06104925
    2 BB06104928
    other one
    PFI
    6318226
    6028689
    6028840
    6029048
    6029568
    6030661
    6029625
    6029336
    6318213
    insert into integ_roads11 (pfi, ufi, geom) ( select b.pfi, c.ufi, c.geom from ora_tr_roads2 b, b_rectangle1 c
    where b.pfi=lv_objectid and c.ufi=mv_ufi and
    sdo_geom.relate( b.geom, 'inside', c.shape, 0.05)='INSIDE');
    so logically it should return this values against becaseu this location is corresponding against to tose features BB06104925
    PFI UFI
    6318226 BB06104925
    6028689 BB06104925
    6028840 BB06104925
    so logically it should return this values against BB06104929
    PFI UFI
    6029048 BB06104929
    6029568 BB06104929
    6030661 BB06104929
    6029625 BB06104929
    6029336 BB06104929
    6318213 BB06104929
    but this query doesnt give this output it retrieves
    PFI UFI
    6318226 BB06104925
    6028689 BB06104925
    6028840 BB06104925
    6029048 BB06104925
    6029568 BB06104925
    6030661 BB06104925
    6029625 BB06104925
    6029336 BB06104925
    6318213 BB06104925
    PFI UFI
    6318226 BB06104929
    6028689 BB06104929
    6028840 BB06104929
    6029048 BB06104929
    6029568 BB06104929
    6030661 BB06104929
    6029625 BB06104929
    6029336 BB06104929
    6318213 BB06104929
    can anybody catch my error in this query.
    Regards

    I have got two Road features (GEo_Road, Road25). Road25 from large scale database and Geo_roads from small scale database. both occupied the same space.
    my task is to extract features of common area means intersection from both features. The two roads might have some common area so i want to extract those area.
    i have drawn a buffer around the small scale (Geo_Road) feature
    which has two records. And then i used sdo_relate funtion to extract all those features from tr_roads which will come inside these buffer . ANd insert these values into another feature class. i have shown records of original tables but didnt copy the sdo field. I have created a small procedure which will work if i select "BB06104925" ufi from "geo_roads" then the control will pass to other database through cursor command and i used step 3 query and this query should give output as step 4. But the query gives output as displayed in step 5. Which is wrong. Sure this will help to understand. If not then i will give more details but plz i need an immediate help. Thanx
    1. GEO_roads Table and data
    NO UFI
    1 BB06104925
    2 BB06104928
    2 .other one (TR_ROADS)
    PFI
    6318226
    6028689
    6028840
    6029048
    6029568
    6030661
    6029625
    6029336
    6318213
    3. insert into integ_roads11 (pfi, ufi, geom) ( select b.pfi, c.ufi, c.geom from ora_tr_roads2 b, b_rectangle1 c
    where b.pfi=lv_objectid and c.ufi=mv_ufi and
    sdo_geom.relate( b.geom, 'inside', c.shape, 0.05)='INSIDE');
    so logically it should return this values against becaseu this location is corresponding against to tose features BB06104925.
    4. PFI UFI
    6318226 BB06104925
    6028689 BB06104925
    6028840 BB06104925
    so logically it should return this values against
    5. BB06104929
    PFI UFI
    6029048 BB06104929
    6029568 BB06104929
    6030661 BB06104929
    6029625 BB06104929
    6029336 BB06104929
    6318213 BB06104929
    but this query doesnt give this output it retrieves
    6.
    PFI UFI
    6318226 BB06104925
    6028689 BB06104925
    6028840 BB06104925
    6029048 BB06104925
    6029568 BB06104925
    6030661 BB06104925
    6029625 BB06104925
    6029336 BB06104925
    6318213 BB06104925
    PFI UFI
    6318226 BB06104929
    6028689 BB06104929
    6028840 BB06104929
    6029048 BB06104929
    6029568 BB06104929
    6030661 BB06104929
    6029625 BB06104929
    6029336 BB06104929
    6318213 BB06104929
    can anybody catch my error in this query.
    Regards

  • Sdo_geom.concave_hull returns 'wrong' polygon

    The sdo_geom.sdo_concavehull function returns on some Multipoints a wrong Polygon.
    Some points of the calculated Polygon seem to be nearly in the middle of the Multipoint Geometry.
    It's hard to explain, so I made a screenshot from SQL Developer:
    [http://666kb.com/i/bxk5jz56tk7tthmbm.gif]
    The black dots is my Multipoint, the red line the result of sdo_geom.sdo_concavehull.
    Is the problem known? Is there any other way to create a concavehull?
    regards

    Not sure if this is the same problem as bug 12847220.
    If you'd like to, you can give us your data set, or contact oracle support.

  • 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

  • Incorrect output by SDO_GEOM.SDO_DISTANCE

    I am trying to calculate the difference of two points on earth, but is not giving me correct result
    SELECT SDO_GEOM.SDO_DISTANCE(
    SDO_GEOMETRY(2001,8307,SDO_POINT_TYPE(28.66667,77.43333,NULL),NULL,NULL),
    SDO_GEOMETRY(2001,8307,SDO_POINT_TYPE(30.45,77.61667,NULL),NULL,NULL),
    0.0001,'unit=km') AS DISTANCE_BETWEEN_POINTS
    FROM DUALI tested it against http://www.movable-type.co.uk/scripts/latlong.html
    Query is returning me 47.6389006
    but the actual distance is: 199.1
    Please help me out.

    I also tested it by
    sqrt(x * x + y * y) * 1.609344 // for KM
    where x = 69.1 * (lat2 - lat1) and y = 53.0 * (lon2 - lon1)
    There is still a lot of difference.
    SQL> SQL> SQL> SELECT SDO_GEOM.SDO_DISTANCE(
    SDO_GEOMETRY(2001,8307,SDO_POINT_TYPE(28.66667,77.43333,NULL),NULL,NULL),
    SDO_GEOMETRY(2001,8307,SDO_POINT_TYPE(30.45,77.61667,NULL),NULL,NULL),
    0.0001,'unit=km') AS DISTANCE_BETWEEN_POINTS
    FROM DUAL  2    3    4    5  ;
    DISTANCE_BETWEEN_POINTS
                 47.6389006
    SQL> SELECT
    sqrt(69.1 * (30.45 - 28.66667) * 69.1 * (30.45 - 28.66667) + 53.0 * (77.61667 - 77.43333) * 53.0 * (77.61667 - 77.43333))  * 1.609344
    FROM DUAL  2    3  ;
    SQRT(69.1*(30.45-28.66667)*69.1*(30.45-28.66667)+53.0*(77.61667-77.43333)*53.0*(
                                                                          198.932013Please help....

Maybe you are looking for

  • How to get the user connection type

    hi all, I have a PAI process to execute only if the user is connected from ESS/MSS. how can I determine the type of connection, if u have some suggestions please help. thanks in advance.

  • How to apply a desktop icon to a DVD that I have burnt?

    When I burn a new DVD, does anyone know how to apply an icon to it? That is to say that when I put the DVD into the drive, it pops up on the desktop with its own individual icon, one that is relevant to the contents of that DVD. When I put in a diffe

  • BSP Exception: Missing reference when converting data object ZZxx

    Hi there, I have created these new Z fields and tried to include them in a field group. These fields did appear, but they are highlighted with a red box, with the above text in the tool tip. Does anyone know what it means?? Thanks

  • Can't install Adobe Flash Player 16

    My greetings ! iMac 21,5 2010 Yosemite 10.10.1 Safari 8.0.2 Adobe Flash Player trying to be installed is v.16 (AdobeFlashPlayerInstaller_16_aaa_aih.dmg) I mount DMG file, start installation app and enter OS X password for permission to make changes.

  • Table rule at bottom of table

    Is there a way to include a line at the bottom of a table using a table style? The Table Border setting puts a border all around the table, and I want the border only underneath the last row in the table. (Using InDesign CS5.)