Funzione st_makeenvelope

Si applica a:check contrassegnato come sì Databricks Runtime 18.2 e versioni successive

Importante

Questa funzionalità è in Anteprima Pubblica.

Restituisce un GEOMETRY valore che rappresenta la busta allineata all'asse 2D (rettangolo di selezione minimo) definita dalle due coordinate (x1, y1) dell'angolo e (x2, y2).

Syntax

st_makeenvelope ( x1, y1, x2, y2 )

Arguments

  • x1 DOUBLE: valore che rappresenta la coordinata X del primo angolo.
  • y1 DOUBLE: valore che rappresenta la coordinata Y del primo angolo.
  • x2 DOUBLE: valore che rappresenta la coordinata X del secondo angolo.
  • y2 DOUBLE: valore che rappresenta la coordinata Y del secondo angolo.

Returns

Valore di tipo GEOMETRY, che rappresenta la busta allineata all'asse 2D dei due angoli di input. Lo SRID della geometria restituita è 0.

Gli angoli di input possono essere forniti in qualsiasi ordine; la busta risultante è uguale a se gli angoli sono stati normalizzati in (xmin, ymin) e (xmax, ymax).

Il tipo della geometria restituita dipende dagli angoli di input:

  • Se la casella viene degenerata in un singolo punto (x1 = x2 e y1 = y2), il risultato è un punto.
  • Se la casella viene degenerata in un segmento (x1 = x2 o y1 = y2, ma non entrambi), il risultato è una linea con due punti.
  • In caso contrario, il risultato è un poligono con cinque vertici (anello chiuso).

La funzione restituisce NULL se uno degli input è NULL.

Examples

-- Returns the polygon envelope defined by two corners.
> SELECT st_astext(st_makeenvelope(1.0, 2.0, 4.0, 6.0));
  POLYGON((1 2,1 6,4 6,4 2,1 2))
-- Corners may be provided in any order.
> SELECT st_astext(st_makeenvelope(4.0, 6.0, 1.0, 2.0));
  POLYGON((1 2,1 6,4 6,4 2,1 2))
-- Returns a point when the box degenerates to a point.
> SELECT st_astext(st_makeenvelope(3.0, 5.0, 3.0, 5.0));
  POINT(3 5)
-- Returns a linestring when the box degenerates to a horizontal segment.
> SELECT st_astext(st_makeenvelope(1.0, 0.0, 4.0, 0.0));
  LINESTRING(1 0,4 0)
-- Returns a linestring when the box degenerates to a vertical segment.
> SELECT st_astext(st_makeenvelope(0.0, 2.0, 0.0, 7.0));
  LINESTRING(0 2,0 7)
-- The SRID of the returned geometry is always 0.
> SELECT st_srid(st_makeenvelope(0.0, 0.0, 10.0, 10.0));
  0