This is an automated email from the ASF dual-hosted git repository.
jiayu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sedona.git
The following commit(s) were added to refs/heads/master by this push:
new 18d28dc5 [DOCS] Add example outputs to all Sedona functions - 7 (#924)
18d28dc5 is described below
commit 18d28dc5573e842e5b4bac7d6dc28d779452cee2
Author: Furqaanahmed Khan <[email protected]>
AuthorDate: Thu Jul 27 15:53:34 2023 -0400
[DOCS] Add example outputs to all Sedona functions - 7 (#924)
---
docs/api/flink/Constructor.md | 239 +++++++++++++++++++++++++++++++++++-----
docs/api/sql/Constructor.md | 251 +++++++++++++++++++++++++++++++++---------
2 files changed, 406 insertions(+), 84 deletions(-)
diff --git a/docs/api/flink/Constructor.md b/docs/api/flink/Constructor.md
index 226719b6..d76fe44c 100644
--- a/docs/api/flink/Constructor.md
+++ b/docs/api/flink/Constructor.md
@@ -7,10 +7,17 @@ Format: `ST_GeomFromGeoHash(geohash: string, precision: int)`
Since: `v1.2.1`
SQL example:
+
```sql
SELECT ST_GeomFromGeoHash('s00twy01mt', 4) AS geom
```
+Output:
+
+```
+POLYGON ((0.703125 0.87890625, 0.703125 1.0546875, 1.0546875 1.0546875,
1.0546875 0.87890625, 0.703125 0.87890625))
+```
+
## ST_GeomFromGeoJSON
Introduction: Construct a Geometry from GeoJson
@@ -20,9 +27,64 @@ Format: `ST_GeomFromGeoJSON (GeoJson:string)`
Since: `v1.2.0`
SQL example:
+
```sql
-SELECT ST_GeomFromGeoJSON(polygontable._c0) AS polygonshape
-FROM polygontable
+SELECT ST_GeomFromGeoJSON('{
+ "type":"Feature",
+ "properties":{
+ "STATEFP":"01",
+ "COUNTYFP":"077",
+ "TRACTCE":"011501",
+ "BLKGRPCE":"5",
+ "AFFGEOID":"1500000US010770115015",
+ "GEOID":"010770115015",
+ "NAME":"5",
+ "LSAD":"BG",
+ "ALAND":6844991,
+ "AWATER":32636
+ },
+ "geometry":{
+ "type":"Polygon",
+ "coordinates":[
+ [
+ [-87.621765, 34.873444],
+ [-87.617535, 34.873369],
+ [-87.62119, 34.85053],
+ [-87.62144, 34.865379],
+ [-87.621765, 34.873444]
+ ]
+ ]
+ }
+}')
+```
+
+Output:
+
+```
+POLYGON ((-87.621765 34.873444, -87.617535 34.873369, -87.62119 34.85053,
-87.62144 34.865379, -87.621765 34.873444))
+```
+
+SQL example:
+
+```sql
+SELECT ST_GeomFromGeoJSON('{
+ "type":"Polygon",
+ "coordinates":[
+ [
+ [-87.621765, 34.873444],
+ [-87.617535, 34.873369],
+ [-87.62119, 34.85053],
+ [-87.62144, 34.865379],
+ [-87.621765, 34.873444]
+ ]
+ ]
+}')
+```
+
+Output:
+
+```
+POLYGON ((-87.621765 34.873444, -87.617535 34.873369, -87.62119 34.85053,
-87.62144 34.865379, -87.621765 34.873444))
```
## ST_GeomFromGML
@@ -35,8 +97,23 @@ Format:
Since: `v1.3.0`
SQL example:
+
```sql
-SELECT ST_GeomFromGML('<gml:LineString
srsName="EPSG:4269"><gml:coordinates>-71.16028,42.258729 -71.160837,42.259112
-71.161143,42.25932</gml:coordinates></gml:LineString>') AS geometry
+SELECT ST_GeomFromGML('
+ <gml:LineString srsName="EPSG:4269">
+ <gml:coordinates>
+ -71.16028,42.258729
+ -71.160837,42.259112
+ -71.161143,42.25932
+ </gml:coordinates>
+ </gml:LineString>
+')
+```
+
+Output:
+
+```
+LINESTRING (-71.16028 42.258729, -71.160837 42.259112, -71.161143 42.25932)
```
## ST_GeomFromKML
@@ -49,13 +126,27 @@ Format:
Since: `v1.3.0`
SQL example:
+
```sql
-SELECT ST_GeomFromKML('<LineString><coordinates>-71.1663,42.2614
-71.1667,42.2616</coordinates></LineString>') AS geometry
+SELECT ST_GeomFromKML('
+ <LineString>
+ <coordinates>
+ -71.1663,42.2614
+ -71.1667,42.2616
+ </coordinates>
+ </LineString>
+')
+```
+
+Output:
+
+```
+LINESTRING (-71.1663 42.2614, -71.1667 42.2616)
```
## ST_GeomFromText
-Introduction: Construct a Geometry from Wkt. Alias of
[ST_GeomFromWKT](#ST_GeomFromWKT)
+Introduction: Construct a Geometry from WKT. Alias of
[ST_GeomFromWKT](#ST_GeomFromWKT)
Format:
`ST_GeomFromText (Wkt:string)`
@@ -63,13 +154,20 @@ Format:
Since: `v1.2.1`
SQL example:
+
```sql
-SELECT ST_GeomFromText('POINT(40.7128 -74.0060)') AS geometry
+SELECT ST_GeomFromText('POINT(40.7128 -74.0060)')
+```
+
+Output:
+
+```
+POINT(40.7128 -74.006)
```
## ST_GeomFromWKB
-Introduction: Construct a Geometry from WKB string or Binary
+Introduction: Construct a Geometry from WKB string or Binary. This function
also supports EWKB format.
Format:
`ST_GeomFromWKB (Wkb:string)`
@@ -78,9 +176,27 @@ Format:
Since: `v1.2.0`
SQL example:
+
```sql
-SELECT ST_GeomFromWKB(polygontable._c0) AS polygonshape
-FROM polygontable
+SELECT ST_GeomFromWKB([01 02 00 00 00 02 00 00 00 00 00 00 00 84 D6 00 C0 00
00 00 00 80 B5 D6 BF 00 00 00 60 E1 EF F7 BF 00 00 00 80 07 5D E5 BF])
+```
+
+Output:
+
+```
+LINESTRING (-2.1047439575195312 -0.354827880859375, -1.49606454372406
-0.6676061153411865)
+```
+
+SQL example:
+
+```sql
+SELECT
ST_asEWKT(ST_GeomFromWKB('01010000a0e6100000000000000000f03f000000000000f03f000000000000f03f'))
+```
+
+Output:
+
+```
+SRID=4326;POINT Z(1 1 1)
```
Format:
@@ -96,7 +212,7 @@ FROM polygontable
## ST_GeomFromWKT
-Introduction: Construct a Geometry from Wkt
+Introduction: Construct a Geometry from WKT
Format:
`ST_GeomFromWKT (Wkt:string)`
@@ -105,20 +221,32 @@ Since: `v1.2.0`
SQL example:
```sql
-SELECT ST_GeomFromWKT('POINT(40.7128 -74.0060)') AS geometry
+SELECT ST_GeomFromWKT('POINT(40.7128 -74.0060)')
+```
+
+Output:
+
+```
+POINT(40.7128 -74.006)
```
## ST_LineFromText
-Introduction: Construct a LineString from Text, delimited by Delimiter
(Optional)
+Introduction: Construct a LineString from Text
-Format: `ST_LineFromText (Text:string, Delimiter:char)`
+Format: `ST_LineFromText (Text:string)`
Since: `v1.2.1`
SQL example:
```sql
-SELECT ST_LineFromText('Linestring(1 2, 3 4)') AS line
+SELECT ST_LineFromText('Linestring(1 2, 3 4)')
+```
+
+Output:
+
+```
+LINESTRING (1 2, 3 4)
```
## ST_LineStringFromText
@@ -129,9 +257,16 @@ Format: `ST_LineStringFromText (Text:string,
Delimiter:char)`
Since: `v1.2.1`
-Spark SQL example:
+Example:
+
```sql
-SELECT ST_LineStringFromText('Linestring(1 2, 3 4)') AS line
+SELECT
ST_LineStringFromText('-74.0428197,40.6867969,-74.0421975,40.6921336,-74.0508020,40.6912794',
',')
+```
+
+Output:
+
+```
+LINESTRING (-74.0428197 40.6867969, -74.0421975 40.6921336, -74.050802
40.6912794)
```
## ST_MLineFromText
@@ -143,9 +278,15 @@ Format: `ST_MLineFromText (Text:string, Srid: int)`
Since: `1.3.1`
SQL example:
+
```sql
-SELECT ST_MLineFromText('MULTILINESTRING((1 2, 3 4), (4 5, 6 7))') AS multiLine
-SELECT ST_MLineFromText('MULTILINESTRING((1 2, 3 4), (4 5, 6 7))', 4269) AS
multiLine
+SELECT ST_MLineFromText('MULTILINESTRING((1 2, 3 4), (4 5, 6 7))')
+```
+
+Output:
+
+```
+MULTILINESTRING ((1 2, 3 4), (4 5, 6 7))
```
## ST_MPolyFromText
@@ -157,9 +298,15 @@ Format: `ST_MPolyFromText (Text:string, Srid: int)`
Since: `1.3.1`
SQL example:
+
```sql
-SELECT ST_MPolyFromText('MULTIPOLYGON(((-70.916 42.1002,-70.9468
42.0946,-70.9765 42.0872 )))') AS multiPolygon
-SELECT ST_MPolyFromText('MULTIPOLYGON(((-70.916 42.1002,-70.9468
42.0946,-70.9765 42.0872 )))', 4269) AS multiPolygon
+SELECT ST_MPolyFromText('MULTIPOLYGON(((0 0 1,20 0 1,20 20 1,0 20 1,0 0 1),(5
5 3,5 7 3,7 7 3,7 5 3,5 5 3)))')
+```
+
+Output:
+
+```
+MULTIPOLYGON (((0 0, 20 0, 20 20, 0 20, 0 0), (5 5, 5 7, 7 7, 7 5, 5 5)))
```
## ST_Point
@@ -171,23 +318,38 @@ Format: `ST_Point (X:decimal, Y:decimal)`
Since: `v1.2.1`
SQL example:
+
```sql
-SELECT ST_Point(x, y) AS pointshape
-FROM pointtable
+SELECT ST_Point(double(1.2345), 2.3456)
+```
+
+Output:
+
+```
+POINT (1.2345 2.3456)
```
## ST_PointZ
-Introduction: Construct a Point from X, Y and Z and an optional srid. If srid
is not set, it defaults to 0 (unknown).
+Introduction: Construct a Point from X, Y and Z and an optional srid. If srid
is not set, it defaults to 0 (unknown).
+Must use ST_AsEWKT function to print the Z coordinate.
Format: `ST_PointZ (X:decimal, Y:decimal, Z:decimal)`
+
Format: `ST_PointZ (X:decimal, Y:decimal, Z:decimal, srid:integer)`
Since: `v1.5.0`
SQL example:
+
```sql
-SELECT ST_PointZ(1.0, 2.0, 3.0) AS pointshape
+SELECT ST_AsEWKT(ST_PointZ(1.2345, 2.3456, 3.4567))
+```
+
+Output:
+
+```
+POINT Z(1.2345 2.3456 3.4567)
```
## ST_PointFromText
@@ -199,8 +361,15 @@ Format: `ST_PointFromText (Text:string, Delimiter:char)`
Since: `v1.2.0`
SQL example:
+
```sql
-SELECT ST_PointFromText('40.7128,-74.0060', ',') AS pointshape
+SELECT ST_PointFromText('40.7128,-74.0060', ',')
+```
+
+Output:
+
+```
+POINT (40.7128 -74.006)
```
## ST_PolygonFromEnvelope
@@ -212,10 +381,15 @@ Format: `ST_PolygonFromEnvelope (MinX:decimal,
MinY:decimal, MaxX:decimal, MaxY:
Since: `v1.2.0`
SQL example:
+
```sql
-SELECT *
-FROM pointdf
-WHERE ST_Contains(ST_PolygonFromEnvelope(1.0,100.0,1000.0,1100.0),
pointdf.pointshape)
+SELECT
ST_PolygonFromEnvelope(double(1.234),double(2.234),double(3.345),double(3.345))
+```
+
+Output:
+
+```
+POLYGON ((1.234 2.234, 1.234 3.345, 3.345 3.345, 3.345 2.234, 1.234 2.234))
```
## ST_PolygonFromText
@@ -227,6 +401,13 @@ Format: `ST_PolygonFromText (Text:string, Delimiter:char)`
Since: `v1.2.0`
SQL example:
+
```sql
-SELECT
ST_PolygonFromText('-74.0428197,40.6867969,-74.0421975,40.6921336,-74.0508020,40.6912794,-74.0428197,40.6867969',
',') AS polygonshape
+SELECT
ST_PolygonFromText('-74.0428197,40.6867969,-74.0421975,40.6921336,-74.0508020,40.6912794,-74.0428197,40.6867969',
',')
+```
+
+Output:
+
+```
+POLYGON ((-74.0428197 40.6867969, -74.0421975 40.6921336, -74.050802
40.6912794, -74.0428197 40.6867969))
```
diff --git a/docs/api/sql/Constructor.md b/docs/api/sql/Constructor.md
index 91776b16..92bc14d8 100644
--- a/docs/api/sql/Constructor.md
+++ b/docs/api/sql/Constructor.md
@@ -52,18 +52,15 @@ Format: `ST_GeomFromGeoHash(geohash: string, precision:
int)`
Since: `v1.1.1`
Spark SQL example:
+
```sql
-SELECT ST_GeomFromGeoHash('s00twy01mt', 4) AS geom
+SELECT ST_GeomFromGeoHash('s00twy01mt', 4)
```
-result:
+Output:
```
-+--------------------------------------------------------------------------------------------------------------------+
-|geom
|
-+--------------------------------------------------------------------------------------------------------------------+
-|POLYGON ((0.703125 0.87890625, 0.703125 1.0546875, 1.0546875 1.0546875,
1.0546875 0.87890625, 0.703125 0.87890625)) |
-+--------------------------------------------------------------------------------------------------------------------+
+POLYGON ((0.703125 0.87890625, 0.703125 1.0546875, 1.0546875 1.0546875,
1.0546875 0.87890625, 0.703125 0.87890625))
```
## ST_GeomFromGeoJSON
@@ -75,16 +72,64 @@ Format: `ST_GeomFromGeoJSON (GeoJson:string)`
Since: `v1.0.0`
Spark SQL example:
-```scala
-var polygonJsonDf =
sparkSession.read.format("csv").option("delimiter","\t").option("header","false").load(geoJsonGeomInputLocation)
-polygonJsonDf.createOrReplaceTempView("polygontable")
-polygonJsonDf.show()
-var polygonDf = sparkSession.sql(
- """
- | SELECT ST_GeomFromGeoJSON(polygontable._c0) AS countyshape
- | FROM polygontable
- """.stripMargin)
-polygonDf.show()
+
+```sql
+SELECT ST_GeomFromGeoJSON('{
+ "type":"Feature",
+ "properties":{
+ "STATEFP":"01",
+ "COUNTYFP":"077",
+ "TRACTCE":"011501",
+ "BLKGRPCE":"5",
+ "AFFGEOID":"1500000US010770115015",
+ "GEOID":"010770115015",
+ "NAME":"5",
+ "LSAD":"BG",
+ "ALAND":6844991,
+ "AWATER":32636
+ },
+ "geometry":{
+ "type":"Polygon",
+ "coordinates":[
+ [
+ [-87.621765, 34.873444],
+ [-87.617535, 34.873369],
+ [-87.62119, 34.85053],
+ [-87.62144, 34.865379],
+ [-87.621765, 34.873444]
+ ]
+ ]
+ }
+}')
+```
+
+Output:
+
+```
+POLYGON ((-87.621765 34.873444, -87.617535 34.873369, -87.62119 34.85053,
-87.62144 34.865379, -87.621765 34.873444))
+```
+
+Spark SQL example:
+
+```sql
+SELECT ST_GeomFromGeoJSON('{
+ "type":"Polygon",
+ "coordinates":[
+ [
+ [-87.621765, 34.873444],
+ [-87.617535, 34.873369],
+ [-87.62119, 34.85053],
+ [-87.62144, 34.865379],
+ [-87.621765, 34.873444]
+ ]
+ ]
+}')
+```
+
+Output:
+
+```
+POLYGON ((-87.621765 34.873444, -87.617535 34.873369, -87.62119 34.85053,
-87.62144 34.865379, -87.621765 34.873444))
```
!!!warning
@@ -100,8 +145,23 @@ Format:
Since: `v1.3.0`
SQL example:
+
```sql
-SELECT ST_GeomFromGML('<gml:LineString
srsName="EPSG:4269"><gml:coordinates>-71.16028,42.258729 -71.160837,42.259112
-71.161143,42.25932</gml:coordinates></gml:LineString>') AS geometry
+SELECT ST_GeomFromGML('
+ <gml:LineString srsName="EPSG:4269">
+ <gml:coordinates>
+ -71.16028,42.258729
+ -71.160837,42.259112
+ -71.161143,42.25932
+ </gml:coordinates>
+ </gml:LineString>
+')
+```
+
+Output:
+
+```
+LINESTRING (-71.16028 42.258729, -71.160837 42.259112, -71.161143 42.25932)
```
## ST_GeomFromKML
@@ -114,13 +174,27 @@ Format:
Since: `v1.3.0`
SQL example:
+
```sql
-SELECT ST_GeomFromKML('<LineString><coordinates>-71.1663,42.2614
-71.1667,42.2616</coordinates></LineString>') AS geometry
+SELECT ST_GeomFromKML('
+ <LineString>
+ <coordinates>
+ -71.1663,42.2614
+ -71.1667,42.2616
+ </coordinates>
+ </LineString>
+')
+```
+
+Output:
+
+```
+LINESTRING (-71.1663 42.2614, -71.1667 42.2616)
```
## ST_GeomFromText
-Introduction: Construct a Geometry from Wkt. If srid is not set, it defaults
to 0 (unknown). Alias of [ST_GeomFromWKT](#ST_GeomFromWKT)
+Introduction: Construct a Geometry from WKT. If SRID is not set, it defaults
to 0 (unknown). Alias of [ST_GeomFromWKT](#ST_GeomFromWKT)
Format:
`ST_GeomFromText (Wkt:string)`
@@ -131,13 +205,20 @@ Since: `v1.0.0`
The optional srid parameter was added in `v1.3.1`
Spark SQL example:
+
```sql
-SELECT ST_GeomFromText('POINT(40.7128 -74.0060)') AS geometry
+SELECT ST_GeomFromText('POINT(40.7128 -74.0060)')
+```
+
+Output:
+
+```
+POINT(40.7128 -74.006)
```
## ST_GeomFromWKB
-Introduction: Construct a Geometry from WKB string or Binary
+Introduction: Construct a Geometry from WKB string or Binary. This function
also supports EWKB format.
Format:
`ST_GeomFromWKB (Wkb:string)`
@@ -146,14 +227,32 @@ Format:
Since: `v1.0.0`
Spark SQL example:
+
```sql
-SELECT ST_GeomFromWKB(polygontable._c0) AS polygonshape
-FROM polygontable
+SELECT ST_GeomFromWKB([01 02 00 00 00 02 00 00 00 00 00 00 00 84 D6 00 C0 00
00 00 00 80 B5 D6 BF 00 00 00 60 E1 EF F7 BF 00 00 00 80 07 5D E5 BF])
+```
+
+Output:
+
+```
+LINESTRING (-2.1047439575195312 -0.354827880859375, -1.49606454372406
-0.6676061153411865)
+```
+
+Spark SQL example:
+
+```sql
+SELECT
ST_asEWKT(ST_GeomFromWKB('01010000a0e6100000000000000000f03f000000000000f03f000000000000f03f'))
+```
+
+Output:
+
+```
+SRID=4326;POINT Z(1 1 1)
```
## ST_GeomFromWKT
-Introduction: Construct a Geometry from Wkt. If srid is not set, it defaults
to 0 (unknown).
+Introduction: Construct a Geometry from WKT. If SRID is not set, it defaults
to 0 (unknown).
Format:
`ST_GeomFromWKT (Wkt:string)`
@@ -164,13 +263,15 @@ Since: `v1.0.0`
The optional srid parameter was added in `v1.3.1`
Spark SQL example:
+
```sql
-SELECT ST_GeomFromWKT(polygontable._c0) AS polygonshape
-FROM polygontable
+SELECT ST_GeomFromWKT('POINT(40.7128 -74.0060)')
```
-```sql
-SELECT ST_GeomFromWKT('POINT(40.7128 -74.0060)') AS geometry
+Output:
+
+```
+POINT(40.7128 -74.006)
```
## ST_LineFromText
@@ -183,13 +284,15 @@ Format:
Since: `v1.2.1`
Spark SQL example:
+
```sql
-SELECT ST_LineFromText(linetable._c0) AS lineshape
-FROM linetable
+SELECT ST_LineFromText('LINESTRING(1 2,3 4)')
```
-```sql
-SELECT ST_LineFromText('Linestring(1 2, 3 4)') AS line
+Output:
+
+```
+LINESTRING (1 2, 3 4)
```
## ST_LineStringFromText
@@ -201,14 +304,17 @@ Format: `ST_LineStringFromText (Text:string,
Delimiter:char)`
Since: `v1.0.0`
Spark SQL example:
+
```sql
-SELECT ST_LineStringFromText(linestringtable._c0,',') AS linestringshape
-FROM linestringtable
+SELECT
ST_LineStringFromText('-74.0428197,40.6867969,-74.0421975,40.6921336,-74.0508020,40.6912794',
',')
```
-```sql
-SELECT
ST_LineStringFromText('-74.0428197,40.6867969,-74.0421975,40.6921336,-74.0508020,40.6912794',
',') AS linestringshape
+Output:
+
+```
+LINESTRING (-74.0428197 40.6867969, -74.0421975 40.6921336, -74.050802
40.6912794)
```
+
## ST_MLineFromText
Introduction: Construct a MultiLineString from Wkt. If srid is not set, it
defaults to 0 (unknown).
@@ -220,9 +326,15 @@ Format:
Since: `v1.3.1`
Spark SQL example:
+
```sql
-SELECT ST_MLineFromText('MULTILINESTRING((1 2, 3 4), (4 5, 6 7))') AS
multiLine;
-SELECT ST_MLineFromText('MULTILINESTRING((1 2, 3 4), (4 5, 6 7))',4269) AS
multiLine;
+SELECT ST_MLineFromText('MULTILINESTRING((1 2, 3 4), (4 5, 6 7))')
+```
+
+Output:
+
+```
+MULTILINESTRING ((1 2, 3 4), (4 5, 6 7))
```
## ST_MPolyFromText
@@ -236,10 +348,15 @@ Format:
Since: `v1.3.1`
Spark SQL example:
+
```sql
-SELECT ST_MPolyFromText('MULTIPOLYGON(((-70.916 42.1002,-70.9468
42.0946,-70.9765 42.0872 )))') AS multiPolygon
-SELECT ST_MPolyFromText('MULTIPOLYGON(((-70.916 42.1002,-70.9468
42.0946,-70.9765 42.0872 )))',4269) AS multiPolygon
+SELECT ST_MPolyFromText('MULTIPOLYGON(((0 0 1,20 0 1,20 20 1,0 20 1,0 0 1),(5
5 3,5 7 3,7 7 3,7 5 3,5 5 3)))')
+```
+
+Output:
+```
+MULTIPOLYGON (((0 0, 20 0, 20 20, 0 20, 0 0), (5 5, 5 7, 7 7, 7 5, 5 5)))
```
## ST_Point
@@ -254,23 +371,38 @@ In `v1.4.0` an optional Z parameter was removed to be
more consistent with other
If you are upgrading from an older version of Sedona - please use ST_PointZ to
create 3D points.
Spark SQL example:
+
```sql
-SELECT ST_Point(CAST(pointtable._c0 AS Decimal(24,20)), CAST(pointtable._c1 AS
Decimal(24,20))) AS pointshape
-FROM pointtable
+SELECT ST_Point(double(1.2345), 2.3456)
+```
+
+Output:
+
+```
+POINT (1.2345 2.3456)
```
## ST_PointZ
Introduction: Construct a Point from X, Y and Z and an optional srid. If srid
is not set, it defaults to 0 (unknown).
+Must use ST_AsEWKT function to print the Z coordinate.
Format: `ST_PointZ (X:decimal, Y:decimal, Z:decimal)`
+
Format: `ST_PointZ (X:decimal, Y:decimal, Z:decimal, srid:integer)`
Since: `v1.4.0`
Spark SQL example:
+
```sql
-SELECT ST_PointZ(1.0, 2.0, 3.0) AS pointshape
+SELECT ST_AsEWKT(ST_PointZ(1.2345, 2.3456, 3.4567))
+```
+
+Output:
+
+```
+POINT Z(1.2345 2.3456 3.4567)
```
## ST_PointFromText
@@ -282,13 +414,15 @@ Format: `ST_PointFromText (Text:string, Delimiter:char)`
Since: `v1.0.0`
Spark SQL example:
+
```sql
-SELECT ST_PointFromText(pointtable._c0,',') AS pointshape
-FROM pointtable
+SELECT ST_PointFromText('40.7128,-74.0060', ',')
```
-```sql
-SELECT ST_PointFromText('40.7128,-74.0060', ',') AS pointshape
+Output:
+
+```
+POINT (40.7128 -74.006)
```
## ST_PolygonFromEnvelope
@@ -300,10 +434,15 @@ Format: `ST_PolygonFromEnvelope (MinX:decimal,
MinY:decimal, MaxX:decimal, MaxY:
Since: `v1.0.0`
Spark SQL example:
+
```sql
-SELECT *
-FROM pointdf
-WHERE ST_Contains(ST_PolygonFromEnvelope(1.0,100.0,1000.0,1100.0),
pointdf.pointshape)
+SELECT
ST_PolygonFromEnvelope(double(1.234),double(2.234),double(3.345),double(3.345))
+```
+
+Output:
+
+```
+POLYGON ((1.234 2.234, 1.234 3.345, 3.345 3.345, 3.345 2.234, 1.234 2.234))
```
## ST_PolygonFromText
@@ -315,11 +454,13 @@ Format: `ST_PolygonFromText (Text:string, Delimiter:char)`
Since: `v1.0.0`
Spark SQL example:
+
```sql
-SELECT ST_PolygonFromText(polygontable._c0,',') AS polygonshape
-FROM polygontable
+SELECT
ST_PolygonFromText('-74.0428197,40.6867969,-74.0421975,40.6921336,-74.0508020,40.6912794,-74.0428197,40.6867969',
',')
```
-```sql
-SELECT
ST_PolygonFromText('-74.0428197,40.6867969,-74.0421975,40.6921336,-74.0508020,40.6912794,-74.0428197,40.6867969',
',') AS polygonshape
+Output:
+
+```
+POLYGON ((-74.0428197 40.6867969, -74.0421975 40.6921336, -74.050802
40.6912794, -74.0428197 40.6867969))
```