Funzione st_pointonsurface

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

Importante

Questa funzionalità è in Anteprima Pubblica.

Restituisce un punto che è garantito che si trova all'interno o all'interno del valore di input GEOMETRY .

Syntax

st_pointonsurface ( geoExpr )

Arguments

  • geoExpr: un valore GEOMETRY.

Returns

Valore del punto GEOMETRY 2D che è garantito di trovarsi all'interno o nel valore di input GEOMETRY . Più precisamente:

  • Se il valore di input GEOMETRY è vuoto, viene restituito il punto vuoto 2D.
  • Se il valore di input GEOMETRY è un punto non vuoto, viene restituita la proiezione 2D del punto.
  • Se il valore di input GEOMETRY è una stringa di riga non vuota, viene restituito il vertice mediano.
  • Se il valore di input GEOMETRY è un poligono non vuoto, viene restituito un punto all'interno del poligono, se possibile; in caso contrario, un punto sul limite.
  • Se il valore di input GEOMETRY è un multipunto, viene restituito il punto non vuoto più vicino al centro del rettangolo di selezione.
  • Se il valore di input GEOMETRY è una stringa multilinea, viene restituito un punto sulla superficie della linea con la lunghezza più grande.
  • Se il valore di input GEOMETRY è un multipolygon, viene restituito un punto sulla superficie del poligono con l'area più grande.
  • Se il valore di input GEOMETRY è una raccolta geometry, viene restituito un punto sulla superficie di uno degli elementi dimensionali massimi della raccolta.

Il valore SRID del valore di output GEOMETRY è uguale a quello del valore di input.

Examples

-- Example taking a 2D polygon.
> SELECT st_asewkt(st_pointonsurface(st_geomfromtext('POLYGON((0 0,10 0,10 10,0 10,0 0))')));
  POINT(5 5)

-- Example taking a 2D polygon with a hole: the result lies in the donut region.
> SELECT st_asewkt(st_pointonsurface(st_geomfromtext('POLYGON((0 0,30 0,30 30,0 30,0 0),(5 5,25 5,25 25,5 25,5 5))')));
  POINT(3.75 3.75)

-- Example taking a 3DZ linestring: the median vertex is returned and the Z coordinate is dropped.
> SELECT st_asewkt(st_pointonsurface(st_geomfromtext('LINESTRING Z (1 2 -1,3 4 -2,5 6 -3)')));
  POINT(3 4)

-- Example taking a multipolygon: a point on the polygon with the largest area is returned.
> SELECT st_asewkt(st_pointonsurface(st_geomfromtext('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0)),((100 100,101 100,101 101,100 101,100 100)))')));
  POINT(5 5)

-- Example showing that the SRID is preserved.
> SELECT st_asewkt(st_pointonsurface(st_geomfromtext('POLYGON((0 0,10 0,10 10,0 10,0 0))', 3857)));
  SRID=3857;POINT(5 5)

-- Example taking a NULL input.
> SELECT st_pointonsurface(NULL);
  NULL