st_force2d Função

Aplica-se a:assinalado com um visto Databricks SQL, assinalado com um visto Databricks Runtime 18.1 ou superiores

Importante

Este recurso está no Public Preview.

Note

Esse recurso não está disponível nos armazéns Databricks SQL Classic. Para saber mais sobre os armazéns SQL do Databricks, consulte Tipos de armazém SQL.

Devolve a projeção 2D da entrada GEOGRAPHY ou GEOMETRY valor.

Sintaxe

st_force2d ( geoExpr )

Argumentos

  • geoExpr: um valor GEOGRAPHY ou GEOMETRY.

Devoluções

Um valor do tipo GEOGRAPHY ou GEOMETRY, representando a projeção 2D do valor de entrada.

O valor SRID da saída GEOGRAPHY ou GEOMETRY valor é igual ao valor de entrada.

A função retorna NULL se a entrada for NULL.

Notes

Se a entrada tiver coordenadas Z ou M, estas são excluídas da saída.

Se a entrada já for 2D, a função devolve-a sem alterações.

Exemplos

-- Drops the M coordinate from a point geography.
> SELECT st_astext(st_force2d(st_geogfromtext('POINT M (1 2 3)')));
  POINT(1 2)
-- Drops Z and M coordinates from a multipoint geography.
> SELECT st_astext(st_force2d(st_geogfromtext('MULTIPOINT ZM (EMPTY,0 0 10 20, 1 1 11 21)')));
  MULTIPOINT(EMPTY,(0 0),(1 1))
-- Drops the Z coordinate from a polygon geography.
> SELECT st_astext(st_force2d(st_geogfromtext('POLYGON Z ((0 0 2,1 0 3,0 1 4,0 0 5))')));
  POLYGON((0 0,1 0,0 1,0 0))
-- Drops the Z coordinate from a point geometry.
> SELECT st_astext(st_force2d(st_geomfromtext('POINT Z (1 2 3)')));
  POINT(1 2)
-- Drops Z and M coordinates from a linestring geometry.
> SELECT st_astext(st_force2d(st_geomfromtext('LINESTRING ZM (0 0 10 20, 1 1 11 21)')));
  LINESTRING(0 0,1 1)
-- Returns the input 2D geometry as is.
> SELECT st_astext(st_force2d(st_geomfromtext('POINT(1 2)')));
  POINT(1 2)
-- Preserves the SRID of the input geography.
> SELECT st_srid(st_force2d(st_geogfromtext('POINT(1 2)')));
  4326
-- Preserves the SRID of the input geometry.
> SELECT st_srid(st_force2d(st_geomfromtext('POINT(1 2)', 4326)));
  4326
-- Returns NULL if the input is NULL.
> SELECT st_force2d(NULL);
   NULL