2 Replies Latest reply: Apr 1, 2014 5:45 PM by FlyingGuy RSS

    Geometry sub select

    FlyingGuy

      Hey there folks...

       

      So 11gR2, EE, linux server

       

      So what, I need to be able to do is to chop up a geometry into small segments, that equal the original geometry.  So I start out with something like this:

       

      MDSYS.SDO_GEOMETRY(2002,8307,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1),MDSYS.SDO_ORDINATE_ARRAY(-117.97528,34.13969,-117.97534,34.13969,-117.97589,34.13969))
      

       

      For sake of argument say this geometry represents 100 meters of roadway, it could be straight or on a curve.  I need to subdivide this into n meter segments each representing the geometry with reasonable fidelity.  So start at 0 meters and go to 19, then 20 to 39, 40 to 59 etc.  Each would be a linestring as the above represents.  I have sortof figured out a way to brute force it by taking the geometry apart and preforming various functions ( point of a bearing and distance, etc ) but I was thinking there just has to be a better way.

       

      Any ideas?

        • 1. Re: Geometry sub select
          navaneet

          You can can try Linear Referencing methods such as SDO_LRS.CLIP_GEOM_SEGMENT.

           

           

          select

          SDO_LRS.CLIP_GEOM_SEGMENT (

          SDO_LRS.CONVERT_TO_LRS_GEOM

          (

            MDSYS.SDO_GEOMETRY(2002,8307,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1),MDSYS.SDO_ORDINATE_ARRAY(-117.97528,34.13969,-117.97534,34.13969,-117.97589,34.13969)),

            0,   -- start measure value

            100  -- end measure value

          )

          ,0,10)

          from dual;

           

           

          select MDSYS.SDO_GEOMETRY(2002,null,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1),MDSYS.SDO_ORDINATE_ARRAY(0,0,0,0,0,100)) from dual;

          select

          SDO_LRS.CONVERT_TO_LRS_GEOM

          (

            MDSYS.SDO_GEOMETRY(2002,null,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1),MDSYS.SDO_ORDINATE_ARRAY(0,0,0,0,0,100)),

            0,   -- start measure value

            100  -- end measure value

          )

          from dual;

           

          -- 100 ft

           

          select

          SDO_LRS.CLIP_GEOM_SEGMENT (

          SDO_LRS.CONVERT_TO_LRS_GEOM

          (

            MDSYS.SDO_GEOMETRY(2002,null,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1),MDSYS.SDO_ORDINATE_ARRAY(0,0,0,0,0,100)),

            0,   -- start measure value

            100  -- end measure value

          )

          ,0,10) test_clipping

          from dual;

          -- Result is 10 ft

           

          TEST_CLIPPING(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)

          ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

          SDO_GEOMETRY(3302, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1), SDO_ORDINATE_ARRAY(0, 0, 0, 0, 10, 10))

           

           

           

          Best

          Navaneet

          • 2. Re: Geometry sub select
            FlyingGuy

            Hey Navaneet.  Worked pretty darn well.  Thanks!