5 Replies Latest reply: Nov 27, 2012 9:09 PM by don123 RSS

    Bearing

    don123
      hi


      The function SDO_UTIL.BEARING_TILT_FOR_POINTS takes start point and end point in geodetic coordinates. Is there any to use this function if coordinates are in projection system (UTM) ? I have used this function in geodetic system.

      regards
        • 1. Re: Bearing
          Luc Van Linden
          Hi

          Have a look at this older thread:

          Re: distance and direction

          put that into a function. (works for 2D projected points).


          The same logic is used in this thread to turn the result into a "compas" returning N, E, W, S:

          Re: Query based on direction

          I hope this helps you out.

          Luc
          • 2. Re: Bearing
            user8048037
            You could of course transform the data into geodetic, calculate and tranfsorm back:
            --calculate point 1000m 0° (north)
            --  use WGS84 geodetic (8307) / ETRS89 UTM32 projected /25832)
            SELECT SDO_CS.TRANSFORM(
                     SDO_UTIL.POINT_AT_BEARING( 
                       SDO_CS.TRANSFORM(
                        SDO_GEOMETRY(2001, 25832,SDO_POINT_TYPE(634176, 5618187, NULL), NULL, NULL),
                        8307),
                     0,1000),
                   25832)  
              FROM DUAL;  
              
            
            -- SDO_GEOMETRY(2001, 25832,SDO_POINT_TYPE(634150.34, 5619186.49, NULL), NULL, NULL),  
            
            --check the distance in projected -> aproximate
            SELECT SDO_GEOM.SDO_DISTANCE(
                     SDO_GEOMETRY(2001, 25832,SDO_POINT_TYPE(634176.00, 5618187.00, NULL), NULL, NULL),
                     SDO_GEOMETRY(2001, 25832,SDO_POINT_TYPE(634150.34, 5619186.49, NULL), NULL, NULL),
                     0.1) 
                   FROM dual;
            
            --999.82
            
            --check the distance in geodetic -> exact
            -- it is exactly northern
            SELECT SDO_GEOM.SDO_DISTANCE(
                     SDO_GEOMETRY(2001, 8307,SDO_POINT_TYPE(10.9000100360663, 50.7089939346931, NULL), NULL, NULL),
                     SDO_GEOMETRY(2001, 8307,SDO_POINT_TYPE(10.9000100360663, 50.7000045737259, NULL), NULL, NULL),
                     0.1) 
                   FROM dual;
            
            --999.999995296258       
            • 3. Re: Bearing
              don123
              Luc,

              Thanks, the link (Re: distance and direction works for me.

              I understand that atan of delta in x,y coordinates is computed.
              Can you explain me necessity to check whether delta is equal to zero, greater than zero etc...

              regards
              • 4. Re: Bearing
                Luc Van Linden
                Hi

                Glad it helps. Maybe you can reward some points ;-)

                In the calculations is a division by the delta Y. if this is 0 you will get a division by zero error.
                delta Y is = 0 when the directions are either 90 = pi / 2 or 270 = 3 * (pi / 2). To find this out you have to check delta X bigger or smaller then zero.

                The second bit is to check which quadrant you'll end up in (when delta Y is not zero), and to act accordingly, adding or subtracting the the ATAN from 0, 90, 180, 360.

                Regards

                Luc
                • 5. Re: Bearing
                  don123
                  Thanks Luc