Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SDO_CS.MAKE_2D for 4D LRS data

John O'TooleOct 10 2012 — edited Oct 16 2012
This is a moan, not a question. I'm running Oracle database 11.2.0.3. Lets say I've got a valid 4D LRS geometry:
jot_test@11gR2> select sdo_geom.validate_geometry_with_context(
  2    sdo_geometry(4402, null, null, sdo_elem_info_array(1,2,1), sdo_ordinate_array(
  3    500100, 600100, 10, 100,
  4    500200, 600200, 9, 200,
  5    500300, 600300, 14, 300,
  6    500400, 600400, 11, 400))
  7  ,0.005) as valid
  8  from dual;

VALID
-------------------------------------------------------------------------------------
TRUE
And I want to convert this back to a simple 2D geometry. So I naively try:
jot_test@11gR2> select sdo_cs.make_2d(
  2  sdo_geometry(4402, null, null, sdo_elem_info_array(1,2,1), sdo_ordinate_array(
  3    500100, 600100, 10, 100,
  4    500200, 600200, 9, 200,
  5    500300, 600300, 14, 300,
  6    500400, 600400, 11, 400))
  7  ) as geom2d
  8  from dual;

GEOM2D(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
---------------------------------------------------------------------------------------------------------------------------------------------------------
SDO_GEOMETRY(3402, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1), SDO_ORDINATE_ARRAY(500100, 600100, 100, 500200, 9, 200, 600300, 14, 500400, 600400, NULL))
As you can see that returns a woefully invalid geometry. So I checked the doco for SDO_CS.MAKE_2D ( http://docs.oracle.com/cd/E11882_01/appdev.112/e11830/sdo_cs_ref.htm#CHDBCAEE ) and noticed that it only accepts a 3D geometry.

So my moan of the day is - why can't Oracle make the extra bit of effort (extra 10 lines of code?) to make the SDO_CS.MAKE_2D function a bit more flexible? And surely the function shouldn't be returning totally invalid output for a valid input - how about some basic error checking in the function!

In the end I am able to convert the LRS data to 2D by running Simon Greener's geom.to_2d() function which works perfectly.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 13 2012
Added on Oct 10 2012
4 comments
2,145 views