3 Replies Latest reply: Aug 28, 2013 7:29 AM by Fa RSS

    Identifying Start and End Points of Curved geometries

    user154136

      I am trying to identify a way to get the starting and endpoints of a polygon that has curved lines (example below). I am trying to identify the four corners so that I can get a proper bearing orientation for the polygon. I have an approach for rectangular polygons but am hitting a wall with curved polygons. I was wondering if anyone else had done similar effort or was working on one so that we could possibly work together to come to a solution.

       

      Thanks

      Robert

       

      select

      MDSYS.SDO_GEOMETRY(2003,8307,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1),MDSYS.SDO_ORDINATE_ARRAY(-94.3817886665432,41.0814066669203,-94.3818499999904,41.0814200000164,-94.3816042483547,41.0806969443469,-94.3815372415646,41.0805891184763,-94.3814385466158,41.0804324975069,-94.3813467776427,41.0802876228031,-94.3812792495333,41.0802262793508,-94.381154582244,41.0801649358412,-94.3810074055848,41.0800866249107,-94.380891395748,41.080017450173,-94.3807771174051,41.0799404442298,-94.3806368667046,41.0797120362974,-94.3805641441134,41.0795488872809,-94.380536440279,41.0794757963831,-94.3802899999934,41.0768300000117,-94.3802554242879,41.0768307882157,-94.380479301099,41.0794797119773,-94.3805883849771,41.0797263933975,-94.3807199782251,41.07995480128,-94.3808827382955,41.080070962703,-94.3810887856285,41.0801753772899,-94.3812827125212,41.0802954538687,-94.3815564198269,41.0807117695166,-94.3817886665432,41.0814066669203)) geom

      from dual

        • 1. Re: Identifying Start and End Points of Curved geometries
          Barbara Boehmer

          You can get the minimum bounding rectangle like so:

           

          SCOTT@orcl12c_11gR2> with

            2    curves as

            3       (select MDSYS.SDO_GEOMETRY

            4             (2003,8307,NULL,

            5              MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1),

            6              MDSYS.SDO_ORDINATE_ARRAY

            7                (-94.3817886665432,41.0814066669203,

            8                 -94.3818499999904,41.0814200000164,

            9                 -94.3816042483547,41.0806969443469,

          10                 -94.3815372415646,41.0805891184763,

          11                 -94.3814385466158,41.0804324975069,

          12                 -94.3813467776427,41.0802876228031,

          13                 -94.3812792495333,41.0802262793508,

          14                 -94.381154582244,41.0801649358412,

          15                 -94.3810074055848,41.0800866249107,

          16                 -94.380891395748,41.080017450173,

          17                 -94.3807771174051,41.0799404442298,

          18                 -94.3806368667046,41.0797120362974,

          19                 -94.3805641441134,41.0795488872809,

          20                 -94.380536440279,41.0794757963831,

          21                 -94.3802899999934,41.0768300000117,

          22                 -94.3802554242879,41.0768307882157,

          23                 -94.380479301099,41.0794797119773,

          24                 -94.3805883849771,41.0797263933975,

          25                 -94.3807199782251,41.07995480128,

          26                 -94.3808827382955,41.080070962703,

          27                 -94.3810887856285,41.0801753772899,

          28                 -94.3812827125212,41.0802954538687,

          29                 -94.3815564198269,41.0807117695166,

          30                 -94.3817886665432,41.0814066669203)) geom

          31        from     dual)

          32  select sdo_geom.sdo_mbr (geom) "minimum bounding rectangle"

          33  from   curves

          34  /

           

          minimum bounding rectangle(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INF

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

          SDO_GEOMETRY(2003, 8307, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 3), SDO_ORDINATE_ARR

          AY(-94.38185, 41.07683, -94.380255, 41.08142))

           

           

          1 row selected.

          • 2. Re: Identifying Start and End Points of Curved geometries
            user154136

            Thanks Barbara,  the minimum bounding rectangle will not work since there could be points in the middle that are further esat/west than the actual corners of the polygon. I am thinking that I will have to map to a cartesian system and possible try to identify the actual corners that way.

            • 3. Re: Identifying Start and End Points of Curved geometries
              Fa

              Robert,

              Your question is a bit confusing. A curved polygon is a polygon that has arced edges. But your sample geometry is a simple polygon with straight lines. furthermore  you can not compute orientation (AKA Bearing  and even Azimuth) of an arc. you can do it with simple straight lines.

              In addition , I recommend to use the open source packages by Simon call "Codesys" from [here] which has done all the hard work. To solve your problem with the function from the package, use this query:

               

              Select T.Id,
                (Round(Codesys.Cogo.Bearing(T.Startcoord.Assdogeometry(8307).Sdo_Point, T.Endcoord.Assdogeometry(8307).Sdo_Point) * 180 / Codesys.Constants.Pi,2)) Bearings,
                T.Startcoord.Assdogeometry(8307) Start_Point,
                T.Startcoord.Assdogeometry(8307) End_Point
              From Table(Codesys.Geom.Getvector( Mdsys.Sdo_Geometry(2003,8307,Null,Mdsys.Sdo_Elem_Info_Array(1,1003,1),Mdsys.Sdo_Ordinate_Array(-94.3817886665432,41.0814066669203,-94.3818499999904,41.0814200000164,-94.3816042483547,41.0806969443469,-94.3815372415646,41.0805891184763,-94.3814385466158,41.0804324975069,-94.3813467776427,41.0802876228031,-94.3812792495333,41.0802262793508,-94.381154582244,41.0801649358412,-94.3810074055848,41.0800866249107,-94.380891395748,41.080017450173,-94.3807771174051,41.0799404442298,-94.3806368667046,41.0797120362974,-94.3805641441134,41.0795488872809,-94.380536440279,41.0794757963831,-94.3802899999934,41.0768300000117,-94.3802554242879,41.0768307882157,-94.380479301099,41.0794797119773,-94.3805883849771,41.0797263933975,-94.3807199782251,41.07995480128,-94.3808827382955,41.080070962703,-94.3810887856285,41.0801753772899,-94.3812827125212,41.0802954538687,-94.3815564198269,41.0807117695166,-94.3817886665432,41.0814066669203)) ,0.1) ) T;
              

               

              This query gives you the bearings in degree(between 0 to 360).

              Fa