# Issue

This Content is from Stack Overflow. Question asked by Dusan

In my database I have some Oriented Point type geometries.

For example:

`{3001,4326,null,{1,1,1,4,1,0},{32.4302549,37.5066298,0,0.16,-0.92,0}}`

If I’m correct, my gps coordinates are
lat: 32.4302549, lon: 37.5066298
and the virtual point determining the orientation is a Point(0.16 -0.92 0)

I would like to get the orientation in degrees or radians using a query.

So far I can extract the orientation point:

``````SELECT SDO_UTIL.GET_COORDINATE(G3E_GEOMETRY, 2) as orientation_vector
FROM GCOL;
``````

But don’t know how to get the orientation. I know it can be calculated vie arctan2 function, but don’t know the correct oracle syntax.

# Solution

You need to use ATAN2 to get radians with the correct quadrant.

``````WITH X AS (
SELECT
SDO_GEOMETRY(3001,4326,NULL,
SDO_ELEM_INFO_ARRAY(1, 1, 1, 4, 1,0),
SDO_ORDINATE_ARRAY(32.4302549, 37.5066298, 0, 0.16, - 0.92,0)) AS G
FROM DUAL
)
SELECT
ATAN2(
SDO_UTIL.GET_COORDINATE(G, 2).SDO_POINT.Y ,
SDO_UTIL.GET_COORDINATE(G, 2).SDO_POINT.X)
FROM X;
``````

To convert to degrees please see SDO_UTIL.CONVERT_UNIT .

``` This Question was asked in  StackOverflow by  Dusan and Answered by David Lapp It is licensed under the terms of
CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.```