Oracle Spatial - Point

Syntax

A point is defined through the SDO_GEOMETRY data type.

Example:

sdo_geometry (
    2001, -- in 2 dimensions, un point
    90112, -- A SRID/ EPSG Netherlands National coordinate System (Projected)
    null, 
    sdo_elem_info_array (1,1,1), 
    sdo_ordinate_array (4,7474195,52,4726167) -- boundary of a spatial object (longitude, latitude)
)
sdo_geometry(
    2001, 
    8307,
    mdsys.sdo_point_type(longitude, latitude, NULL),
    NULL, 
    NULL);

Coordinate System transformation

Coordinate System transformation of the point 104074, 463638 in the SRID 28992 to a Longitude / Latitude point : SRID 8307 EPSG 4326 - WGS 84.

SELECT
  t.X,
  t.Y
FROM
  (
    SELECT
      SDO_CS.TRANSFORM( MDSYS.SDO_GEOMETRY( 2001, 28992, MDSYS.SDO_POINT_TYPE(
      104074, 463638, NULL ), NULL, NULL ), 8307 ) AS geometry
    FROM
      dual
  )
  geo,
  TABLE( SDO_UTIL.GETVERTICES( geo.geometry ) ) t;
X	                Y
4.64312958337903	52.1585525979256

It was also possible to use this SRID 8199 EPSG 4011 - Arc 1950

Function

-- Create a function to return a point geometry (SDO_GTYPE = 2001) with
-- input of 2 numbers: longitude and latitude (SDO_SRID = 8307, for
-- "Longitude / Latitude (WGS 84)",  probably the most widely used 
--  coordinate system, and the one used for GPS devices.
-- Specify DETERMINISTIC for the function.

create or replace function get_long_lat_pt(longitude in number, 
                                           latitude in number)
return MDSYS.SDO_GEOMETRY deterministic is
begin
     return mdsys.sdo_geometry(2001, 8307, 
                mdsys.sdo_point_type(longitude, latitude, NULL),NULL, NULL);
end;
/

Powered by ComboStrap