Select to view content in your preferred language

Construct ST_GEOMETRY rectangle from two vertices

237
0
06-07-2022 10:32 PM
Status: Open
Bud
by
Esteemed Contributor
SDE.ST_GEOMETRY in Oracle:

I have two vertices of a rectangle:

  • Lower-left: 10,10
  • Upper-right: 100,100

I want to construct a rectangle polygon from those two vertices using ST_GEOMETRY functions.

Currently, there doesn't seem to be a a way to construct that rectangle using only the two vertices. It seems like the only way to construct the rectangle is to determine what all four (or five?) vertices are — and construct the rectangle that way.


It would help if functionality could be added so that we could construct an ST_GEOMETRY rectangle from just the lower-left and upper-right vertices.

Similar to what we can do with SDO_GEOMETRY's rectangle functionality:

select
sdo_geometry(2003, 26917, null, sdo_elem_info_array(1, 1003, 3),
sdo_ordinate_array(665287.423,4857578.086, 676832.320,4878119.585))
-- only two vertices 🡅 🡅
from
dual

Result:
[MDSYS.SDO_GEOMETRY]