diff --git a/_sources/api/spatial-functions.rst.txt b/_sources/api/spatial-functions.rst.txt index 09c758292..e2ccc9464 100644 --- a/_sources/api/spatial-functions.rst.txt +++ b/_sources/api/spatial-functions.rst.txt @@ -454,6 +454,60 @@ st_difference +-----------------------------------------------------------+ +st_dimension +************ + +.. function:: st_dimension(col) + + Compute the dimension of the geometry. + + :param col: Geometry + :type col: Column + :rtype: Column: IntegerType + + :example: + +.. tabs:: + .. code-tab:: py + + >>> df = spark.createDataFrame([{'wkt': 'POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))'}]) + >>> df.select(st_dimension('wkt')).show() + +-----------------+ + |st_dimension(wkt)| + +-----------------+ + | 2| + +-----------------+ + + .. code-tab:: scala + + >>> val df = List("POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))").toDF("wkt") + >>> df.select(st_dimension(col("wkt"))).show() + +-----------------+ + |st_dimension(wkt)| + +-----------------+ + | 2| + +-----------------+ + + .. code-tab:: sql + + >>> SELECT st_dimension("POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))") + +-----------------+ + |st_dimension(wkt)| + +-----------------+ + | 2| + +-----------------+ + + .. code-tab:: r R + + >>> df <- createDataFrame(data.frame(wkt = "POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))")) + >>> showDF(select(df, st_dimension(column("wkt")))) + +-----------------+ + |st_dimension(wkt)| + +-----------------+ + | 2| + +-----------------+ + + st_distance *********** diff --git a/api/api.html b/api/api.html index 8477d0a1b..2a8b6225a 100644 --- a/api/api.html +++ b/api/api.html @@ -124,6 +124,7 @@

API Documentationst_centroid
  • st_convexhull
  • st_difference
  • +
  • st_dimension
  • st_distance
  • st_dump
  • st_envelope
  • diff --git a/api/spatial-functions.html b/api/spatial-functions.html index 8f3740c11..68146173e 100644 --- a/api/spatial-functions.html +++ b/api/spatial-functions.html @@ -563,6 +563,62 @@

    st_difference +

    st_dimension

    +
    +
    +st_dimension(col)
    +

    Compute the dimension of the geometry.

    +
    +
    Parameters
    +

    col (Column) – Geometry

    +
    +
    Return type
    +

    Column: IntegerType

    +
    +
    Example
    +

    +
    +
    + +
    +
    >>> df = spark.createDataFrame([{'wkt': 'POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))'}])
    +>>> df.select(st_dimension('wkt')).show()
    ++-----------------+
    +|st_dimension(wkt)|
    ++-----------------+
    +|                2|
    ++-----------------+
    +
    +
    +
    +

    st_distance

    @@ -585,7 +641,7 @@

    st_distance -
    df = spark.createDataFrame([{'point': 'POINT (5 5)', 'poly': 'POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))'}])
    +

    -
    df = spark.createDataFrame([{'wkt': 'POLYGON((5.84 45.64, 5.92 45.64, 5.89 45.81, 5.79 45.81, 5.84 45.64))'}])
    +