st_numinteriorrings

Importante

La compatibilidad con los valores GEOGRAPHY está en versión preliminar pública. La compatibilidad con valores GEOMETRY está disponible con carácter general.

Devuelve el número de anillos interiores del polígono de entrada.

Para obtener la función SQL de Databricks correspondiente, consulte st_numinteriorrings function.

Syntax

from pyspark.databricks.sql import functions as dbf

dbf.st_numinteriorrings(col=<col>)

Parámetros

Parámetro Tipo Description
col pyspark.sql.Column o str Valor Geography o Geometry que representa un polígono.

Notas

La función devuelve None si la entrada es None.

Se espera que el valor de entrada represente un polígono; de lo contrario, se devuelve un error.

Examples

from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('POLYGON EMPTY',)], ['wkt'])
df.select(dbf.st_numinteriorrings(dbf.st_geomfromtext('wkt', 4326)).alias('result')).collect()
[Row(result=0)]
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('POLYGON Z ((0 0 6,1 0 6,1 1 8,0 1 6,0 0 6))',)], ['wkt'])
df.select(dbf.st_numinteriorrings(dbf.st_geogfromtext('wkt')).alias('result')).collect()
[Row(result=0)]
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('POLYGON ZM ((0 0 111 -11,10 0 222 -22,0 10 333 -33,0 0 444 -44),(1 1 555 -55,4 1 666 -66,1 4 777 -77,1 1 888 -88))',)], ['wkt'])
df.select(dbf.st_numinteriorrings(dbf.st_geomfromtext('wkt', 4326)).alias('result')).collect()
[Row(result=1)]
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('POLYGON M ((0 0 1,10 0 2,0 10 3,0 0 1),(1 1 2,2 1 3,1 2 4,1 1 2),(3 3 3,3 2 4,2 3 5,3 3 3))',)], ['wkt'])
df.select(dbf.st_numinteriorrings(dbf.st_geogfromtext('wkt')).alias('result')).collect()
[Row(result=2)]