Find the minimum distance between two SDO_GEOMETRY in Oracle Spatial?

annular ring edit.png

A circle (SDO_GEOMETRY)
B - polygon (SDO_GEOMETRY)

CASE:
B contains A (or)
The Interior of B.

How to find the minimum distance between A and B in Oracle Spatial

Hello guuid nameless person.

What is

my_answer := MDSYS.SDO_GEOM.SDO_DISTANCE(
   my_circle_geometry
  ,MDSYS.SDO_UTIL.POLYGONTOLINE(my_outer_polygon)
  ,my_tolerance
);

Now, you may need to pay attention to the holes in your polygon, would you the distance and an inner ring if it was closer to you?

If the measure is only to outer rings, so something like

my_answer := MDSYS.SDO_GEOM.SDO_DISTANCE(
   my_circle_geometry
  ,MDSYS.SDO_UTIL.POLYGONTOLINE(
      MDSYS.SDO_UTIL.EXTRACT(my_outer_polygon,1,1)
   )
  ,my_tolerance
);

And then also beware of the multipolygons as the foregoing only measured against the first polygon in the MultiPolygon.  You need to loop through the polygons of tests just the outer ring in this case.

See you soon,.

Paul

Tags: Database

Similar Questions

  • How to find the ANGLE b/w two edges in Oracle Spatial

    How to find the ANGLE b/w two edges on Oracle Spatial. I have two edge connected on the same node. I wanted to know the angle betwwn them. Can someone help me?

    Ok. My first example is an approximation. Further you get North or South of the Ecuador, gets the more vague.
    This one should do the trick with some degree of precision.

    declare
      PI constant number := 3.14159265358979;
      g1 sdo_geometry;
      g2 sdo_geometry;
      g3 sdo_geometry;
    
      angle1 number;
      angle2 number;
    
      FUNCTION POINT(P_LAT  IN number
                    ,P_LONG IN number)
        RETURN MDSYS.SDO_GEOMETRY IS
      BEGIN
        -- we load both the ordinate array and the point type because some spatial functions show inconsistent behavior
        -- it is not important for this example, just something to be aware of
        return(mdsys.sdo_geometry(2001,8307 -- WGS84
                                 ,mdsys.sdo_point_type(p_long,p_lat,null)
                                                      ,mdsys.sdo_elem_info_array(1,2,1)
                                                      ,mdsys.sdo_ordinate_array(p_long,p_lat)));
      END;
    
    begin
    
      -- For the example, project in WGS84
      -- g1,g2,g3 could also come straight out of the database as sdo_geometry
      g1 := point(50, 7);          -- Point A
      g2 := point(51, 7);          -- Point B
      g3 := point(50,10);          -- Point C
    
      angle1 := atan2(g2.sdo_point.x - g1.sdo_point.x,
                      g2.sdo_point.y - g1.sdo_point.y);
      angle2 := atan2(g3.sdo_point.x - g1.sdo_point.x,
                      g3.sdo_point.y - g1.sdo_point.y);
    
      -- depending on rotation and where we are on the planet, adjustments may be needed
      if angle1 < 0      then angle1 := angle1 + 2 * PI; end if;
      if angle2 < 0      then angle2 := angle2 + 2 * PI; end if;
      if angle2 < angle1 then angle2 := angle2 + 2 * PI; end if;
    
      dbms_output.put_line('Angle between the lines A-B and A-C: '||
                           round(sdo_util.convert_unit(angle2-angle1,'Radian','Degree'),1));
    end;
    
    Angle between the lines A-B and A-C: 90
    
  • Illustrator CS3: How to calculate the exact distance between two points?

    It comes to my line.

    Immagine 1.jpeg

    I have to measure its exact length. How can I do?
    If I use the measure tool, the cursor does not select the snap points, so I have only an approximate measure.
    Is there a quick way to calculate the exact distance between two points?

    Flying document Info Palette menu: turn on the SelectionOnly and objects. The palette will show you the length.

    JET

  • Find the time delay between two signals

    In this code, I sent you a pulse in the acquisition of data using labview. The pulse triggers a thermistor to another analog input input data.

    I want to find the delay between the time of the positive edge of the switch, and the exact time of the DAQ begins to take in the signal of the temperature probe.

    I enclose the code below.

    Thank you.

    Hey,.

    Here is a link to some information about the sources of clock on the FPGA.

    http://digital.NI.com/public.nsf/allkb/94CE338CC80ACF008625791400516BAA?OpenDocument

    Hope this helps

  • Find the intersection/union between two cards

    Hello.
    I'm trying to find out the changes of State between the two cards.
    I have two cards A and B, what I need to do is to find keys in A that exists in key and B in B that does not exist in a..
    If the key exists in both A and B I want to compare the values of these keys.
    What would be the most effective way to apply it.
    My first plan was to make a loop on the keys has to find b and browse the keys b and find in A, but I guess that there is a more efficient algorithm.
    I think also on the use of java.util.Collections to find union-intersection between the keys in the cards, but then I need to do a search in the two
    maps.
    Any suggestions?
    Concerning
    / Fredrik

    Fredrik wrote:
    My script is as follows:
    I am writing a Swing application for administration of a clustered environment.
    The keys in the map contains the ip address of the cluster nodes, the value is a State of a node in the cluster.
    I want to report the change of State of the node in the GUI.
    A state change occurs if there is a new node in the cluster, which means a new entry to the card since the last audit, or if a node
    Let the cluster has remove entry on the map since the last audit, or if the situation or condition for entry/ip has changed since the last audit.
    Concerning
    / Fredrik

    By your senario above, I don't think that you have two objects on the map, there is a single object and you want to report the change in the GUI, whenever an object is the value added, deleted or by itself is changed (key is the same) to the map.

    Then, I suggest below things:
    (1) override hashcode and equals method. (Because each time the methods put and putAll are called the hash code equal method checks in the bucket for the equal and similar hash code and if its equal, and then change the GUI for the existing map).
    (2) as suggested earlier, substitute methods of deletion. (Whenever an object is deleted, accordingly you can change the GUI).
    (3) as was suggested earlier, override a method put and putAll (whenever a new object is added, so you can change the GUI).

    And to do this, I don't think you have to browse the map.

  • I can't find how to change the distance between two lines of text

    ureself
    ureself

    I mean the vertical distance between the two lines with mmmmm

    http://codeverge.com/Mozilla.support.Thunderbird/line-spacing-how-to-double-space/1402587

    http://forums.mozillazine.org/viewtopic.php?f=39 & t = 403487

  • Calculating the distance between two images... ?

    Hello

    I'm trying to calculate the distance between two images (A and F - there are other images between A and F), but I can't seem to understand how to make good sense.

    Image A.x is "(stage/2)-(A.width/2)" and the image of F.x is "provable - imgSpace" which is a negative value (all images x is a negative value for image A.x). "

    In my view, the calculation is F.x - A.x, and although it could be good I still ned the value to be non-negative.

    Does anyone know how to do this?

    Thanks in advanse...

    I think you can find out the distance with this equation,

    var len:Numer = Math.abs (A.x - F.x);

  • Find the minimum date on multiple columns

    Hello

    I have two questions to find the minimum date on several columns:
    1. need a select query that should JOIN two tables and return any information (CASSEDTL) table with minimum date out of DATEISSUED, DATEPLACED, DATEENTERED and STATDATE.
    2. need of an update query that should update all cases in the CASEDTL table with the minimum date of DATEISSUED, DATEPLACED, DATEENTERED and STATDATE.

    The DDL:
    CREATE TABLE CASEMSTR 
    (   CASENBR     NUMBER,
        DATEISSUED  DATE,
        DATEPLACED  DATE,
        DATEENTERED DATE);
        
    CREATE TABLE CASEDTL 
    (   CASENBR     NUMBER,
        STATDATE    DATE,
        RCVDATE    DATE,
        MODDATE     DATE);
        
    INSERT INTO CASEMSTR VALUES (1, '1 JUL 2007', '1 JUL 2007', '12 JUL 2007');
    INSERT INTO CASEMSTR VALUES (2, '1 JAN 2008', '1 JAN 2008', '21 JAN 2008');
    INSERT INTO CASEMSTR VALUES (3, NULL, NULL, '3 DEC 2008');
    INSERT INTO CASEMSTR VALUES (4, '31 MAR 2009', NULL, '6 APR 2009');
    INSERT INTO CASEMSTR VALUES (5, NULL, '22 MAR 2009', '6 APR 2009');    
    INSERT INTO CASEMSTR VALUES (6, NULL, NULL, '16 JUL 2009');
    INSERT INTO CASEMSTR VALUES (7, '1 DEC 2008', '7 DEC 2008', '26 DEC 2008');
    INSERT INTO CASEMSTR VALUES (8, NULL, NULL, '17 MAY 2009');
    
    INSERT INTO CASEDTL VALUES (1, '25 JUN 2007', NULL, '2 AUG 2009');
    INSERT INTO CASEDTL VALUES (2, '1 JAN 2008', NULL, '2 AUG 2009');
    INSERT INTO CASEDTL VALUES (3, '11 NOV 2008', NULL, '2 AUG 2009');
    INSERT INTO CASEDTL VALUES (4, '31 MAR 2009', NULL, '2 AUG 2009');
    INSERT INTO CASEDTL VALUES (5, '19 JUL 2009', NULL, '2 AUG 2009');    
    INSERT INTO CASEDTL VALUES (6, '13 JUN 2009', NULL, '16 JUL 2009');
    INSERT INTO CASEDTL VALUES (7, '7 DEC 2008', NULL, '16 JUL 2009');
    INSERT INTO CASEDTL VALUES (8, '14 MAY 2009', NULL, '16 JUL 2009');
    COMMIT;
    The initial query I have is
    SELECT CD.CASENBR, CM.DATEISSUED, CM.DATEPLACED, CM.DATEENTERED, CD.STATDATE, CD.RCVDATE, NULL "NEW RCV DT" 
    FROM CASEDTL CD
        INNER JOIN CASEMSTR CM
            ON CD.CASENBR = CM.CASENBR;
    Need to know what is the best way to complete the new Date of RRS? Receive a new date should be the minimum date of DATEISSUED, DATEPLACED, DATEENTERED and STATDATE. And also how do I write an update statement unique to upade date of receipt in the detail table?

    Any help would be appreciated! Thanks in advance!

    Where is the function LESS? Refer to manual SQL.

    HTH - Mark D Powell.

    put1 > desc multdate
     Name                                      Null?    Type
     ----------------------------------------- -------- ----------------------------
     COL1                                               DATE
     COL2                                               DATE
     COL3                                               DATE
    
    put1 > select * from multdate;
    11-AUG-09 10-AUG-09 01-AUG-09
    
    put1 > select least(col1, col2, col3) from multdate;
    01-AUG-09
    

    Published by: MarkDPowell on August 11, 2009 15:53 added example

  • PL/SQL loop to find the minimum value

    I want to find the minimum value from a table using the pl/sql loop

    I have data format below.

    1 ABC 2

    1 ABC 20

    1 ABC 500

    1 ABC 2000

    XYZ 2 250

    JKL 3 300

    MNP 3 350

    3 KLM 400

    I wrote the code below. His does not work. Please suggest.

    Set serveroutput on
    declare
    x number: = 3;
    y VARCHAR2 (3): = 'ABC ';
    fmin number: = 0;
    number of Fmax: = 0;
    Start
    for rec in (select sal from test
    where id = name and x = y) loop


    If rec.sal > fmin then
    fmin: = rec.sal;
    on the other
    FMAX: = rec.sal;
    fmin: = fmax.
    end if;
    end loop;
    dbms_output.put_line (Fmax);
    end;
    /

    I want to output 2 on top of code.

    Thanks in advance

    Why PL/SQL? SELECT MIN (SAL) OF TEST will be more rapid and much less coding. In any case:

    declare

    number of v_min_sal;

    Start

    for v_rec in a loop (select sal from emp)

    If nvl (v_min_sal, v_rec.sal + 1) > v_rec.sal

    then

    v_min_sal: = v_rec.sal;

    end if;

    end loop;

    dbms_output.put_line (' lowest salaray is "' |") v_min_sal | '"');

    end;

    /

    The lowest Salaray is "800".

    PL/SQL procedure successfully completed.

    SQL >

    SY.

  • How do the time difference between two dates?

    Hi all

    I use this query to get the time difference between two dates.

    Select to_timestamp ('2012-10-03 12:00 ',' YYYY-MM-DD hh)-to_timestamp ('2012-10-03 11:00 ',' YYYY-MM-DD hh) as double diff;

    but do not get the correct result.

    Thank you

    Left KEY... Left Padding of tanks.

  • Is it possible to establish the selection square between two Guides...?

    Hello world

    Is it possible to establish the square selection between two Guides. Guides are up & down (or) left and right.

    The rectangle has been fixed ratio 200 X 200. Thanks in advance.

    1.jpg

    -yajiv

    This requires Photoshop CS5 or better...

    #target photoshop
    app.bringToFront();
    main();
    function main(){
    if(app.version.match(/\d+/) < 12) return;
    if(!documents.length) return;
    var doc = activeDocument;
    var guides = doc.guides;
    if(guides.length != 2) return;
    if(guides[0].direction != guides[1].direction) return;
    var startRulerUnits = preferences.rulerUnits;
    preferences.rulerUnits = Units.PIXELS;
    var SB = new Array();
    if(guides[0].direction == Direction.HORIZONTAL && guides[1].direction == Direction.HORIZONTAL){
    var vertDistance = doc.guides[1].coordinate.value - doc.guides[0].coordinate.value;
    SB[0] = (doc.width.value - vertDistance)/2;
    SB[1] = doc.guides[0].coordinate.value;
    SB[2] =  ((doc.width.value - vertDistance)/2)+vertDistance;
    SB[3] = doc.guides[1].coordinate.value;
        }
    if(guides[0].direction == Direction.VERTICAL && guides[1].direction == Direction.VERTICAL){
    var horzDistance = doc.guides[1].coordinate.value - doc.guides[0].coordinate.value;
    SB[0] = doc.guides[0].coordinate.value;
    SB[1] = (doc.height - horzDistance)/2;
    SB[2] = doc.guides[1].coordinate.value;
    SB[3] = ((doc.height - horzDistance)/2)+horzDistance;
        }
    activeDocument.selection.select([[SB[0],SB[1]],[SB[2],SB[1]],[SB[2],SB[3]],[SB[0],SB[3]]], SelectionType.REPLACE, 0, false);
    app.preferences.rulerUnits = startRulerUnits;
    }
    
  • How to remove the white space between two response reports

    How to remove the white space between two response reports

    In the section of dashboard, I have 2 rqeuest. Each query returns Table view. When I view the dashboard, it shows a blank separating 2 table views. How can I get rid of the band of white/white space?

    See this link

    Re: Remove the space between the two reports on the dashboard page OBIEE Section

    Kind regards
    Sandeep

  • How to write a query for the data exchange between two columns?

    How to write a query for the data exchange between two columns?

    I tried a request, does NOT work.
    update tmp t1 set t1.m1=t1.m2 and t1.m2=(select t2.m1 from tmp t2 where t2.student_id = t1.student_id)
    Thank you.

    Published by: user533361 on October 23, 2009 14:04

    Just plain and simple:

    update tmp t1
     set t1.m1=t1.m2,
         t1.m2=t1.m1
    /
    

    SY.

  • SQL - find the minimum value for each separate record...

    Hi all

    I have a table like this in SQL Server

    Date of sale of product
    A date
    A date
    A date
    B date of
    B date of
    C date
    C date
    C date

    I would like to write a query to find the minimum date (i.e. the date
    the first sale) for each product

    Thus, the expected results would be

    Date of sale of product
    A date min
    B date of min
    C date of min

    How can I do this using SQL Server?

    any help is greatly appreciated!

    Thank you!

    Product SELECTION, MIN (sale_date)
    From your_table
    GROUP BY product

    Etienne

  • find the distance between two major axis chart point cloud

    Hello

    I have a scatter chart. Its the y-axis AutoScale property is set to false. The major and minor axes are by default. Interval is set by default.

    When draw the graph divisions displayed on the axis are defined according to the range provided. Sometimes, the interval between the major divisions, that is exactly what is defined in the Interval property and sometimes this isn't the same thing. As mentioned in the help the AutoScale property is set to true, sometimes by himself in order to avoid the congested labels.

    What I find is the distance beween two major axes of the value axis, as the interval is not the same as set in the property.

    Kindly let me know how to calculate the interval.

    Kind regards

    Nihad.

    yAxis1.AutoSpacingMajorInterval

    Replace yAxis1 by what is called your axis y on the scatter graph. If you don't know what it is, right click on the axis are the scatter graph, and then select Edit YAxes. Then a box will appear and you can see how it's called in the members section.

Maybe you are looking for