You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@sedona.apache.org by "jiayuasu (via GitHub)" <gi...@apache.org> on 2023/07/27 03:41:57 UTC
[GitHub] [sedona] jiayuasu commented on a diff in pull request #924: [DOCS] Add example outputs to all Sedona functions - 7
jiayuasu commented on code in PR #924:
URL: https://github.com/apache/sedona/pull/924#discussion_r1275690118
##########
docs/api/flink/Constructor.md:
##########
@@ -20,9 +27,41 @@ Format: `ST_GeomFromGeoJSON (GeoJson:string)`
Since: `v1.2.0`
SQL example:
+
```sql
-SELECT ST_GeomFromGeoJSON(polygontable._c0) AS polygonshape
-FROM polygontable
+SELECT ST_GeomFromGeoJSON('{
Review Comment:
Please also show an example that uses only the geometry field of a GeoJSON file.
##########
docs/api/flink/Constructor.md:
##########
@@ -49,22 +103,43 @@ 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)`
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
Review Comment:
Please specify that this function supports EWKB format. Example input: `01010000a0e6100000000000000000f03f000000000000f03f000000000000f03f`
Please use ST_asEWKT to print it.
##########
docs/api/sql/Constructor.md:
##########
@@ -75,16 +72,41 @@ 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":{
Review Comment:
Same here
##########
docs/api/sql/Constructor.md:
##########
@@ -146,14 +204,20 @@ 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])
Review Comment:
Please specify this supports EWKB, and put an example for it: 01010000a0e6100000000000000000f03f000000000000f03f000000000000f03f
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org