2 Replies Latest reply on Apr 10, 2014 8:02 PM by FlyingGuy

# Is there a simple way to create a linestring sdo

11gR2 EE all the usual bells and whistles.

Dear smarter than me Spatial Peeps!,

So is there a way to simply create a 2D linestring SDO from two 2D point SDO's ?

I HAVE A 2D point that I use:

P2 := SDO_UTIL.POINT_AT_BEARING(P1,0.5,50) ;

And that gets me a point, at zero radians 50 meters from P1 which is fantastic!  Is there a function that I have not discovered that will take a number of points and return a linestring SDO?

Cheers!

• ###### 1. Re: Is there a simple way to create a linestring sdo

The following function could take two point's coordinates and return a line. Do you think this solves your problem now?

FUNCTION xy2line ( pi_x1 number, pi_y1 number, pi_x2 number, pi_y2 number, srid NUMBER DEFAULT null )

RETURN Mdsys.Sdo_geometry

DETERMINISTIC

IS

Line mdsys.sdo_geometry ;

var_SRID number;

begin

Line := Mdsys.Sdo_geometry( 2002, SRID, null,

MDSYS.SDO_ELEM_INFO_ARRAY(1, 2, 1),

MDSYS.SDO_ORDINATE_ARRAY( pi_x1, pi_y1, pi_x2,pi_y2 ) );

RETURN Line;

END;

Best

Navaneet

• ###### 2. Re: Is there a simple way to create a linestring sdo

Hey Havaneet,

You that answeres it, I was just hoping for some sdo function that would take it n points, but that will work.  It is better then trying to take apart the points and then run them through wkt.

Thanks so much.