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 ca0b075da [DOCS] Enable markdownlint rule `MD031` (#1331)
ca0b075da is described below
commit ca0b075daee8cdf72fb56be88c5e71e5590075b3
Author: John Bampton <[email protected]>
AuthorDate: Thu Apr 11 10:47:00 2024 +1000
[DOCS] Enable markdownlint rule `MD031` (#1331)
https://github.com/DavidAnson/markdownlint/blob/main/doc/md031.md
"Rationale: Aside from aesthetic reasons, some parsers, including kramdown,
will not parse fenced code blocks that don't have blank lines before and after
them."
---
.github/linters/.markdown-lint.yml | 3 -
README.md | 2 +
docs/api/flink/Constructor.md | 4 ++
docs/api/flink/Function.md | 37 +++++++++++
docs/api/flink/Predicate.md | 1 +
docs/api/snowflake/vector-data/Constructor.md | 1 +
docs/api/snowflake/vector-data/Function.md | 75 ++++++++++++++++++++++
docs/api/sql/Constructor.md | 1 +
docs/api/sql/DataFrameAPI.md | 2 +
docs/api/sql/Function.md | 37 +++++++++++
docs/api/sql/Optimizer.md | 7 ++
docs/api/sql/Overview.md | 5 ++
docs/api/sql/Parameter.md | 5 ++
docs/api/sql/Predicate.md | 1 +
docs/api/sql/Raster-loader.md | 1 +
docs/api/sql/Raster-operators.md | 28 ++++++++
docs/api/sql/Raster-visualizer.md | 1 +
docs/api/sql/Visualization_SedonaKepler.md | 2 +
docs/api/sql/Visualization_SedonaPyDeck.md | 3 +
docs/api/viz/sql.md | 5 ++
docs/community/publish.md | 5 ++
docs/community/release-manager.md | 9 +++
docs/community/snapshot.md | 2 +
docs/setup/compile.md | 13 ++++
docs/setup/databricks.md | 7 ++
docs/setup/docker.md | 1 +
docs/setup/flink/install-scala.md | 1 +
docs/setup/install-scala.md | 5 ++
docs/setup/release-notes.md | 5 ++
.../Advanced-Tutorial-Tune-your-Application.md | 4 ++
docs/tutorial/flink/sql.md | 4 ++
docs/tutorial/geopandas-shapely.md | 1 +
docs/tutorial/jupyter-notebook.md | 8 +++
docs/tutorial/rdd.md | 7 ++
docs/tutorial/snowflake/sql.md | 2 +
docs/tutorial/sql.md | 2 +
docs/tutorial/zeppelin.md | 2 +
37 files changed, 296 insertions(+), 3 deletions(-)
diff --git a/.github/linters/.markdown-lint.yml
b/.github/linters/.markdown-lint.yml
index 222927aa5..444a4110c 100644
--- a/.github/linters/.markdown-lint.yml
+++ b/.github/linters/.markdown-lint.yml
@@ -24,9 +24,6 @@ MD026: false
# ol-prefix - Ordered list item prefix
MD029: false
-# blanks-around-fences - Fenced code blocks should be surrounded by blank lines
-MD031: false
-
# blanks-around-lists - Lists should be surrounded by blank lines
MD032: false
diff --git a/README.md b/README.md
index eedfa9de5..939c88383 100644
--- a/README.md
+++ b/README.md
@@ -78,6 +78,7 @@ This example loads NYC taxi trip records and taxi zone
information stored as .CS
taxidf = sedona.read.format('csv').option("header","true").option("delimiter",
",").load("s3a://your-directory/data/nyc-taxi-data.csv")
taxidf = taxidf.selectExpr('ST_Point(CAST(Start_Lon AS Decimal(24,20)),
CAST(Start_Lat AS Decimal(24,20))) AS pickup', 'Trip_Pickup_DateTime',
'Payment_Type', 'Fare_Amt')
```
+
```python
zoneDf = sedona.read.format('csv').option("delimiter",
",").load("s3a://your-directory/data/TIGER2018_ZCTA5.csv")
zoneDf = zoneDf.selectExpr('ST_GeomFromWKT(_c0) as zone', '_c1 as zipcode')
@@ -122,6 +123,7 @@ We provide a Docker image for Apache Sedona with Python
JupyterLab and a single-
```
pip install apache-sedona
```
+
* To compile the source code, please refer to [Sedona
website](https://sedona.apache.org/latest-snapshot/setup/compile/)
* Modules in the source code
diff --git a/docs/api/flink/Constructor.md b/docs/api/flink/Constructor.md
index 1459e19ca..fe2137fbd 100644
--- a/docs/api/flink/Constructor.md
+++ b/docs/api/flink/Constructor.md
@@ -8,6 +8,7 @@ Format:
Since: `v1.5.0`
Example:
+
```sql
SELECT ST_AsText(ST_GeomFromEWKT('SRID=4269;POINT(40.7128 -74.0060)'))
```
@@ -227,6 +228,7 @@ Format:
Since: `v1.2.1`
Example:
+
```sql
SELECT ST_GeomFromWKB(polygontable._c0) AS polygonshape
FROM polygontable
@@ -242,6 +244,7 @@ Format:
Since: `v1.2.0`
Example:
+
```sql
SELECT ST_GeomFromWKT('POINT(40.7128 -74.0060)')
```
@@ -261,6 +264,7 @@ Format: `ST_LineFromText (Text: String)`
Since: `v1.2.1`
Example:
+
```sql
SELECT ST_LineFromText('Linestring(1 2, 3 4)')
```
diff --git a/docs/api/flink/Function.md b/docs/api/flink/Function.md
index ed2647706..ad62c4551 100644
--- a/docs/api/flink/Function.md
+++ b/docs/api/flink/Function.md
@@ -48,6 +48,7 @@ SELECT ST_3DDistance(ST_GeomFromText("POINT Z (0 0 -5)"),
```
Output:
+
```
1.7320508075688772
```
@@ -65,6 +66,7 @@ Format:
Since: `v1.3.0`
Example:
+
```sql
SELECT ST_AddPoint(ST_GeomFromText("LINESTRING(0 0, 1 1, 1 0)"),
ST_GeomFromText("Point(21 52)"), 1)
@@ -72,6 +74,7 @@ SELECT ST_AddPoint(ST_GeomFromText("Linestring(0 0, 1 1, 1
0)"), ST_GeomFromText
```
Output:
+
```
LINESTRING(0 0, 21 52, 1 1, 1 0)
LINESTRING(0 0, 1 1, 1 0, 21 52)
@@ -222,6 +225,7 @@ SELECT ST_Area(ST_GeomFromText("POLYGON(0 0, 0 10, 10 10, 0
10, 0 0)"))
```
Output:
+
```
10
```
@@ -309,6 +313,7 @@ Format: `ST_AsEWKT (A: Geometry)`
Since: `v1.2.1`
Example:
+
```sql
SELECT ST_AsEWKT(ST_SetSrid(ST_GeomFromWKT('POLYGON((0 0,0 1,1 1,1 0,0 0))'),
4326))
```
@@ -352,6 +357,7 @@ Format: `ST_AsGeoJSON (A: Geometry)`
Since: `v1.3.0`
Example:
+
```sql
SELECT ST_AsGeoJSON(ST_GeomFromWKT('POLYGON((1 1, 8 1, 8 8, 1 8, 1 1))'))
```
@@ -535,6 +541,7 @@ Format: `ST_BoundingDiagonal(geom: Geometry)`
Since: `v1.5.0`
Example:
+
```sql
SELECT ST_BoundingDiagonal(ST_GeomFromWKT(geom))
```
@@ -590,9 +597,11 @@ Format:
```
ST_Buffer (A: Geometry, buffer: Double)
```
+
```
ST_Buffer (A: Geometry, buffer: Double, useSpheroid: Boolean)
```
+
```
ST_Buffer (A: Geometry, buffer: Double, useSpheroid: Boolean,
bufferStyleParameters: String)
```
@@ -654,6 +663,7 @@ Format: `ST_Centroid (A: Geometry)`
Since: `v1.5.0`
Example:
+
```sql
SELECT ST_Centroid(ST_GeomFromWKT('MULTIPOINT(-1 0, -1 2, 7 8, 9 8, 10 6)'))
```
@@ -674,6 +684,7 @@ Format: `ST_ClosestPoint(g1: Geometry, g2: Geometry)`
Since: `v1.5.0`
Example:
+
```sql
SELECT ST_AsText( ST_ClosestPoint(g1, g2)) As ptwkt;
```
@@ -1041,6 +1052,7 @@ Format: `ST_Dump(geom: Geometry)`
Since: `v1.5.0`
Example:
+
```sql
SELECT ST_Dump(ST_GeomFromText('MULTIPOINT ((10 40), (40 30), (20 20), (30
10))'))
```
@@ -1335,11 +1347,13 @@ Default parameters: `tolerance: 1e-6, maxIter: 1000,
failIfNotConverged: false`
Since: `v1.4.1`
Example:
+
```sql
SELECT ST_GeometricMedian(ST_GeomFromWKT('MULTIPOINT((0 0), (1 1), (2 2), (200
200))'))
```
Output:
+
```
POINT (1.9761550281255005 1.9761550281255005)
```
@@ -1397,11 +1411,13 @@ Format: `ST_H3CellDistance(cell1: Long, cell2: Long)`
Since: `v1.5.0`
Example:
+
```sql
select ST_H3CellDistance(ST_H3CellIDs(ST_GeomFromWKT('POINT(1 2)'), 8,
true)[1], ST_H3CellIDs(ST_GeomFromWKT('POINT(1.23 1.59)'), 8, true)[1])
```
Output:
+
```
+----+----------------------+
| op | EXPR$0 |
@@ -1444,11 +1460,13 @@ Format: `ST_H3CellIDs(geom: geometry, level: Int,
fullCover: true)`
Since: `v1.5.0`
Example:
+
```sql
SELECT ST_H3CellIDs(ST_GeomFromText('LINESTRING(1 3 4, 5 6 7)'), 6, true)
```
Output:
+
```
+----+--------------------------------+
| op | EXPR$0 |
@@ -1471,11 +1489,13 @@ Format: `ST_H3KRing(cell: Long, k: Int, exactRing:
Boolean)`
Since: `v1.5.0`
Example:
+
```sql
select ST_H3KRing(ST_H3CellIDs(ST_GeomFromWKT('POINT(1 2)'), 8, true)[1], 1,
false), ST_H3KRing(ST_H3CellIDs(ST_GeomFromWKT('POINT(1 2)'), 8, true)[1], 1,
true)
```
Output:
+
```
+----+--------------------------------+--------------------------------+
| op | EXPR$0 | EXPR$1 |
@@ -1500,11 +1520,13 @@ Format: `ST_H3ToGeom(cells: Array[Long])`
Since: `v1.6.0`
Example:
+
```sql
SELECT ST_H3ToGeom(ST_H3CellIDs(ST_GeomFromWKT('POINT(1 2)'), 8, true)[0], 1,
true))
```
Output:
+
```
[POLYGON ((1.0057629565405093 1.9984665139177547, 1.0037116327309097
2.0018325249140068, 0.999727799357053 2.001163270465665, 0.9977951427833316
1.997128228393235, 0.9998461908217928 1.993762152933182, 1.0038301712104316
1.9944311839965523, 1.0057629565405093 1.9984665139177547))]
```
@@ -1760,9 +1782,11 @@ Introduction: Test if a geometry is well-formed. The
function can be invoked wit
- 1: "ESRI flag", Accepts certain self-touching rings as valid, which are
considered invalid under OGC standards.
Formats:
+
```
ST_IsValid (A: Geometry)
```
+
```
ST_IsValid (A: Geometry, flag: Integer)
```
@@ -1789,9 +1813,11 @@ Introduction: Returns text stating if the geometry is
valid. If not, it provides
- 1: "ESRI flag", Accepts certain self-touching rings as valid, which are
considered invalid under OGC standards.
Formats:
+
```
ST_IsValidReason (A: Geometry)
```
+
```
ST_IsValidReason (A: Geometry, flag: Integer)
```
@@ -1910,6 +1936,7 @@ SELECT
ST_LineInterpolatePoint(ST_GeomFromWKT('LINESTRING(25 50, 100 125, 150 19
```
Output:
+
```
POINT (51.5974135047432 76.5974135047432)
```
@@ -1930,6 +1957,7 @@ SELECT ST_LineLocatePoint(ST_GeomFromWKT('LINESTRING(0 0,
1 1, 2 2)'), ST_GeomFr
```
Output:
+
```
0.5
```
@@ -1946,6 +1974,7 @@ Format: `ST_LineMerge (A: Geometry)`
Since: `v1.5.0`
Example:
+
```sql
SELECT ST_LineMerge(ST_GeomFromWKT('MULTILINESTRING ((-29 -27, -30 -29.7, -45
-33), (-45 -33, -46 -32))'))
```
@@ -2059,6 +2088,7 @@ WITH linestring AS (
```
Result:
+
```
+------------------+------------------------+
|st_makevalid(geom)|st_makevalid(geom, true)|
@@ -2391,6 +2421,7 @@ Example:
SELECT ST_ReducePrecision(ST_GeomFromWKT('Point(0.1234567890123456789
0.1234567890123456789)')
, 9)
```
+
The new coordinates will only have 9 decimal places.
Output:
@@ -2542,11 +2573,13 @@ Format: `ST_ShiftLongitude (geom: geometry)`
Since: `v1.6.0`
SQL example:
+
```SQL
SELECT ST_ShiftLongitude(ST_GeomFromText('LINESTRING(177 10, 179 10, -179 10,
-177 10)'))
```
Output:
+
```sql
LINESTRING(177 10, 179 10, 181 10, 183 10)
```
@@ -2653,12 +2686,14 @@ Format: `ST_SubDivide(geom: Geometry, maxVertices:
Integer)`
Since: `v1.5.0`
Example:
+
```sql
SELECT ST_SubDivide(ST_GeomFromText("POLYGON((35 10, 45 45, 15 40, 10 20, 35
10), (20 30, 35 35, 30 20, 20 30))"), 5)
```
Output:
+
```
[
POLYGON((37.857142857142854 20, 35 10, 10 20, 37.857142857142854 20)),
@@ -2685,6 +2720,7 @@ SELECT ST_SubDivide(ST_GeomFromText("LINESTRING(0 0, 85
85, 100 100, 120 120, 21
```
Output:
+
```
[
LINESTRING(0 0, 5 5)
@@ -3055,6 +3091,7 @@ Format: `ST_ZMax(geom: Geometry)`
Since: `v1.3.1`
Example:
+
```sql
SELECT ST_ZMax(ST_GeomFromText('POLYGON((0 0 1, 1 1 1, 1 2 1, 1 1 1, 0 0 1))'))
```
diff --git a/docs/api/flink/Predicate.md b/docs/api/flink/Predicate.md
index 7e7573dd5..c5780ba6c 100644
--- a/docs/api/flink/Predicate.md
+++ b/docs/api/flink/Predicate.md
@@ -93,6 +93,7 @@ SELECT ST_DWithin(ST_GeomFromWKT(-122.335167 47.608013),
ST_GeomFromWKT(-73.9352
```
Output:
+
```
true
```
diff --git a/docs/api/snowflake/vector-data/Constructor.md
b/docs/api/snowflake/vector-data/Constructor.md
index ae18496c6..954a05c2d 100644
--- a/docs/api/snowflake/vector-data/Constructor.md
+++ b/docs/api/snowflake/vector-data/Constructor.md
@@ -9,6 +9,7 @@ Format:
`ST_GeomFromEWKT (EWkt:string)`
SQL example:
+
```sql
SELECT ST_AsText(ST_GeomFromEWKT('SRID=4269;POINT(40.7128 -74.0060)'))
```
diff --git a/docs/api/snowflake/vector-data/Function.md
b/docs/api/snowflake/vector-data/Function.md
index 322ef49af..4c4cede1e 100644
--- a/docs/api/snowflake/vector-data/Function.md
+++ b/docs/api/snowflake/vector-data/Function.md
@@ -40,6 +40,7 @@ Introduction: Return the 3-dimensional minimum cartesian
distance between A and
Format: `ST_3DDistance (A:geometry, B:geometry)`
SQL example:
+
```SQL
SELECT ST_3DDistance(polygondf.countyshape, polygondf.countyshape)
FROM polygondf
@@ -54,6 +55,7 @@ Format: `ST_AddPoint(geom: geometry, point: geometry,
position: integer)`
Format: `ST_AddPoint(geom: geometry, point: geometry)`
SQL example:
+
```SQL
SELECT ST_AddPoint(ST_GeomFromText('LINESTRING(0 0, 1 1, 1 0)'),
ST_GeomFromText('Point(21 52)'), 1)
@@ -61,6 +63,7 @@ SELECT ST_AddPoint(ST_GeomFromText('Linestring(0 0, 1 1, 1
0)'), ST_GeomFromText
```
Output:
+
```
LINESTRING(0 0, 21 52, 1 1, 1 0)
LINESTRING(0 0, 1 1, 1 0, 21 52)
@@ -194,6 +197,7 @@ Introduction: Return the area of A
Format: `ST_Area (A:geometry)`
SQL example:
+
```SQL
SELECT ST_Area(polygondf.countyshape)
FROM polygondf
@@ -222,6 +226,7 @@ Introduction: Return the Well-Known Binary representation
of a geometry
Format: `ST_AsBinary (A:geometry)`
SQL example:
+
```SQL
SELECT ST_AsBinary(polygondf.countyshape)
FROM polygondf
@@ -238,6 +243,7 @@ If the geometry is lacking SRID a WKB format is produced.
Format: `ST_AsEWKB (A:geometry)`
SQL example:
+
```SQL
SELECT ST_AsEWKB(polygondf.countyshape)
FROM polygondf
@@ -254,6 +260,7 @@ If the geometry is lacking SRID a WKT format is produced.
Format: `ST_AsEWKT (A:geometry)`
SQL example:
+
```SQL
SELECT ST_AsEWKT(polygondf.countyshape)
FROM polygondf
@@ -266,6 +273,7 @@ Introduction: Return the [GeoJSON](https://geojson.org/)
string representation o
Format: `ST_AsGeoJSON (A:geometry)`
SQL example:
+
```SQL
SELECT ST_AsGeoJSON(polygondf.countyshape)
FROM polygondf
@@ -278,6 +286,7 @@ Introduction: Return the
[GML](https://www.ogc.org/standards/gml) string represe
Format: `ST_AsGML (A:geometry)`
SQL example:
+
```SQL
SELECT ST_AsGML(polygondf.countyshape)
FROM polygondf
@@ -290,6 +299,7 @@ Introduction: Return the
[KML](https://www.ogc.org/standards/kml) string represe
Format: `ST_AsKML (A:geometry)`
SQL example:
+
```SQL
SELECT ST_AsKML(polygondf.countyshape)
FROM polygondf
@@ -302,6 +312,7 @@ Introduction: Return the Well-Known Text string
representation of a geometry
Format: `ST_AsText (A:geometry)`
SQL example:
+
```SQL
SELECT ST_AsText(polygondf.countyshape)
FROM polygondf
@@ -314,6 +325,7 @@ Introduction: Returns Azimuth for two given points in
radians null otherwise.
Format: `ST_Azimuth(pointA: Point, pointB: Point)`
SQL example:
+
```SQL
SELECT ST_Azimuth(ST_POINT(0.0, 25.0), ST_POINT(0.0, 0.0))
```
@@ -355,6 +367,7 @@ Introduction: Returns the closure of the combinatorial
boundary of this Geometry
Format: `ST_Boundary(geom: geometry)`
SQL example:
+
```SQL
SELECT ST_Boundary(ST_GeomFromText('POLYGON((1 1,0 0, -1 1, 1 1))'))
```
@@ -426,9 +439,11 @@ Format:
```
ST_Buffer (A: Geometry, buffer: Double)
```
+
```
ST_Buffer (A: Geometry, buffer: Double, useSpheroid: Boolean)
```
+
```
ST_Buffer (A: Geometry, buffer: Double, useSpheroid: Boolean,
bufferStyleParameters: String)
```
@@ -494,6 +509,7 @@ Introduction: Return the centroid point of A
Format: `ST_Centroid (A:geometry)`
SQL example:
+
```SQL
SELECT ST_Centroid(polygondf.countyshape)
FROM polygondf
@@ -507,6 +523,7 @@ It will throw an exception indicates illegal argument if
one of the params is an
Format: `ST_ClosestPoint(g1: Geometry, g2: Geometry)`
SQL Example:
+
```sql
SELECT ST_AsText( ST_ClosestPoint(g1, g2)) As ptwkt;
```
@@ -616,6 +633,7 @@ Format: `ST_ConcaveHull (A:geometry, pctConvex:float)`
Format: `ST_ConcaveHull (A:geometry, pctConvex:float, allowHoles:Boolean)`
SQL example:
+
```SQL
SELECT ST_ConcaveHull(polygondf.countyshape, pctConvex)`
FROM polygondf
@@ -628,6 +646,7 @@ Introduction: Return the Convex Hull of polgyon A
Format: `ST_ConvexHull (A:geometry)`
SQL example:
+
```SQL
SELECT ST_ConvexHull(polygondf.countyshape)
FROM polygondf
@@ -753,6 +772,7 @@ Introduction: Return the Euclidean distance between A and B
Format: `ST_Distance (A:geometry, B:geometry)`
SQL example:
+
```SQL
SELECT ST_Distance(polygondf.countyshape, polygondf.countyshape)
FROM polygondf
@@ -767,6 +787,7 @@ Geometry must be in EPSG:4326 (WGS84) projection and must
be in ==lat/lon== orde
Format: `ST_DistanceSphere (A:geometry)`
SQL example 1:
+
```sql
SELECT ST_DistanceSphere(ST_GeomFromWKT('POINT (51.3168 -0.56)'),
ST_GeomFromWKT('POINT (55.9533 -3.1883)'))
```
@@ -774,6 +795,7 @@ SELECT ST_DistanceSphere(ST_GeomFromWKT('POINT (51.3168
-0.56)'), ST_GeomFromWKT
Output: `543796.9506134904`
SQL example 2:
+
```sql
SELECT ST_DistanceSphere(ST_GeomFromWKT('POINT (51.3168 -0.56)'),
ST_GeomFromWKT('POINT (55.9533 -3.1883)'), 6378137.0)
```
@@ -789,6 +811,7 @@ Geometry must be in EPSG:4326 (WGS84) projection and must
be in ==lat/lon== orde
Format: `ST_DistanceSpheroid (A:geometry)`
SQL example:
+
```sql
SELECT ST_DistanceSpheroid(ST_GeomFromWKT('POINT (51.3168 -0.56)'),
ST_GeomFromWKT('POINT (55.9533 -3.1883)'))
```
@@ -802,6 +825,7 @@ Introduction: This is an aggregate function that takes a
column of geometries as
Format: `ST_Dump(geom: geometry)`
SQL example:
+
```SQL
SELECT ST_Dump(tbl.geom)
```
@@ -815,6 +839,7 @@ Introduction: Returns a MultiPoint geometry which consists
of individual points
Format: `ST_DumpPoints(geom: geometry)`
SQL example:
+
```SQL
SELECT ST_DumpPoints(ST_GeomFromText('LINESTRING (0 0, 1 1, 1 0)'))
```
@@ -828,6 +853,7 @@ Introduction: Returns last point of given linestring.
Format: `ST_EndPoint(geom: geometry)`
SQL example:
+
```SQL
SELECT ST_EndPoint(ST_GeomFromText('LINESTRING(100 150,50 60, 70 80, 160
170)'))
```
@@ -854,6 +880,7 @@ Introduction: Returns a line string representing the
exterior ring of the POLYGO
Format: `ST_ExteriorRing(geom: geometry)`
SQL example:
+
```SQL
SELECT ST_ExteriorRing(ST_GeomFromText('POLYGON((0 0 1, 1 1 1, 1 2 1, 1 1 1, 0
0 1))'))
```
@@ -867,6 +894,7 @@ Introduction: Returns a version of the given geometry with
X and Y axis flipped.
Format: `ST_FlipCoordinates(A:geometry)`
SQL example:
+
```SQL
SELECT ST_FlipCoordinates(df.geometry)
FROM df
@@ -1042,11 +1070,13 @@ Format: `ST_GeometricMedian(geom: geometry)`
Default parameters: `tolerance: 1e-6, maxIter: 1000, failIfNotConverged: false`
Example:
+
```sql
SELECT ST_GeometricMedian(ST_GeomFromWKT('MULTIPOINT((0 0), (1 1), (2 2), (200
200))'))
```
Output:
+
```
POINT (1.9761550281255005 1.9761550281255005)
```
@@ -1058,6 +1088,7 @@ Introduction: Return the 0-based Nth geometry if the
geometry is a GEOMETRYCOLLE
Format: `ST_GeometryN(geom: geometry, n: Int)`
SQL example:
+
```SQL
SELECT ST_GeometryN(ST_GeomFromText('MULTIPOINT((1 2), (3 4), (5 6), (8 9))'),
1)
```
@@ -1071,6 +1102,7 @@ Introduction: Returns the type of the geometry as a
string. EG: 'ST_Linestring',
Format: `ST_GeometryType (A:geometry)`
SQL example:
+
```SQL
SELECT ST_GeometryType(polygondf.countyshape)
FROM polygondf
@@ -1125,6 +1157,7 @@ Introduction: Returns the Nth interior linestring ring of
the polygon geometry.
Format: `ST_InteriorRingN(geom: geometry, n: Int)`
SQL example:
+
```SQL
SELECT ST_InteriorRingN(ST_GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0), (1
1, 2 1, 2 2, 1 2, 1 1), (1 3, 2 3, 2 4, 1 4, 1 3), (3 3, 4 3, 4 4, 3 4, 3
3))'), 0)
```
@@ -1151,6 +1184,7 @@ Introduction: RETURNS true if the LINESTRING start and
end point are the same.
Format: `ST_IsClosed(geom: geometry)`
SQL example:
+
```SQL
SELECT ST_IsClosed(ST_GeomFromText('LINESTRING(0 0, 1 1, 1 0)'))
```
@@ -1247,6 +1281,7 @@ Introduction: RETURN true if LINESTRING is ST_IsClosed
and ST_IsSimple.
Format: `ST_IsRing(geom: geometry)`
SQL example:
+
```SQL
SELECT ST_IsRing(ST_GeomFromText('LINESTRING(0 0, 0 1, 1 1, 1 0, 0 0)'))
```
@@ -1274,9 +1309,11 @@ Introduction: Test if a geometry is well-formed. The
function can be invoked wit
- 1: "ESRI flag", Accepts certain self-touching rings as valid, which are
considered invalid under OGC standards.
Formats:
+
```
ST_IsValid (A: Geometry)
```
+
```
ST_IsValid (A: Geometry, flag: Integer)
```
@@ -1301,9 +1338,11 @@ Introduction: Returns text stating if the geometry is
valid. If not, it provides
- 1: "ESRI flag", Accepts certain self-touching rings as valid, which are
considered invalid under OGC standards.
Formats:
+
```
ST_IsValidReason (A: Geometry)
```
+
```
ST_IsValidReason (A: Geometry, flag: Integer)
```
@@ -1347,6 +1386,7 @@ Introduction: Return the perimeter of A
Format: ST_Length (A:geometry)
SQL example:
+
```SQL
SELECT ST_Length(polygondf.countyshape)
FROM polygondf
@@ -1361,6 +1401,7 @@ Geometry must be in EPSG:4326 (WGS84) projection and must
be in ==lat/lon== orde
Format: `ST_LengthSpheroid (A:geometry)`
SQL example:
+
```sql
SELECT ST_LengthSpheroid(ST_GeomFromWKT('Polygon ((0 0, 0 90, 0 0))'))
```
@@ -1398,11 +1439,13 @@ Introduction: Returns a point interpolated along a
line. First argument must be
Format: `ST_LineInterpolatePoint (geom: geometry, fraction: Double)`
SQL example:
+
```SQL
SELECT ST_LineInterpolatePoint(ST_GeomFromWKT('LINESTRING(25 50, 100 125, 150
190)'), 0.2) as Interpolated
```
Output:
+
```
+-----------------------------------------+
|Interpolated |
@@ -1424,6 +1467,7 @@ SELECT ST_LineLocatePoint(ST_GeomFromWKT('LINESTRING(0 0,
1 1, 2 2)'), ST_GeomFr
```
Output:
+
```
0.5
```
@@ -1449,11 +1493,13 @@ Introduction: Return a linestring being a substring of
the input one starting an
Format: `ST_LineSubstring (geom: geometry, startfraction: Double, endfraction:
Double)`
SQL example:
+
```SQL
SELECT ST_LineSubstring(ST_GeomFromWKT('LINESTRING(25 50, 100 125, 150 190)'),
0.333, 0.666) as Substring
```
Output:
+
```
+------------------------------------------------------------------------------------------------+
|Substring
|
@@ -1505,6 +1551,7 @@ Format: `ST_MakePolygon(geom: geometry, holes:
<geometry>)`
Example:
Query:
+
```SQL
SELECT
ST_MakePolygon(
@@ -1544,6 +1591,7 @@ WITH linestring AS (
```
Result:
+
```
+------------------+------------------------+
|st_makevalid(geom)|st_makevalid(geom, true)|
@@ -1565,6 +1613,7 @@ Introduction: Returns the smallest circle polygon that
contains a geometry.
Format: `ST_MinimumBoundingCircle(geom: geometry, [Optional]
quadrantSegments:int)`
SQL example:
+
```SQL
SELECT ST_MinimumBoundingCircle(ST_GeomFromText('POLYGON((1 1,0 0, -1 1, 1
1))'))
```
@@ -1576,6 +1625,7 @@ Introduction: Returns two columns containing the center
point and radius of the
Format: `ST_MinimumBoundingRadius(geom: geometry)`
SQL example:
+
```SQL
SELECT ST_MinimumBoundingRadius(ST_GeomFromText('POLYGON((1 1,0 0, -1 1, 1
1))'))
```
@@ -1710,6 +1760,7 @@ Introduction: RETURNS number of interior rings of polygon
geometries.
Format: `ST_NumInteriorRings(geom: geometry)`
SQL example:
+
```SQL
SELECT ST_NumInteriorRings(ST_GeomFromText('POLYGON ((0 0, 0 5, 5 5, 5 0, 0
0), (1 1, 2 1, 2 2, 1 2, 1 1))'))
```
@@ -1738,6 +1789,7 @@ IllegalArgumentException: Unsupported geometry type:
MultiPoint, only LineString
```
SQL Example:
+
```sql
SELECT ST_NumPoints(ST_GeomFromText('LINESTRING(0 1, 1 0, 2 0)'))
```
@@ -1751,6 +1803,7 @@ Introduction: Return the Nth point in a single linestring
or circular linestring
Format: `ST_PointN(geom: geometry, n: integer)`
SQL example:
+
```SQL
SELECT ST_PointN(ST_GeomFromText('LINESTRING(0 0, 1 2, 2 4, 3 6)'), 2) AS geom
```
@@ -1826,6 +1879,7 @@ SQL Example:
SELECT ST_ReducePrecision(ST_GeomFromWKT('Point(0.1234567890123456789
0.1234567890123456789)')
, 9)
```
+
The new coordinates will only have 9 decimal places.
Output:
@@ -1843,6 +1897,7 @@ Format: `ST_RemovePoint(geom: geometry, position:
integer)`
Format: `ST_RemovePoint(geom: geometry)`
SQL example:
+
```SQL
SELECT ST_RemovePoint(ST_GeomFromText('LINESTRING(0 0, 1 1, 1 0)'), 1)
```
@@ -1882,11 +1937,13 @@ the cells will be smaller, the coverage will be more
accurate, but the result si
Format: `ST_S2CellIDs(geom: geometry, level: Int)`
SQL example:
+
```SQL
SELECT ST_S2CellIDs(ST_GeomFromText('LINESTRING(1 3 4, 5 6 7)'), 6)
```
Output:
+
```
+------------------------------------------------------------------------------------------------------------------------------+
|st_s2cellids(st_geomfromtext(LINESTRING(1 3 4, 5 6 7), 0), 6)
|
@@ -1924,6 +1981,7 @@ Introduction: Sets the spatial reference system
identifier (SRID) of the geometr
Format: `ST_SetSRID (A:geometry, srid: Integer)`
SQL example:
+
```SQL
SELECT ST_SetSRID(polygondf.countyshape, 3021)
FROM polygondf
@@ -1941,11 +1999,13 @@ Format: `ST_ShiftLongitude (geom: geometry)`
Since: `v1.6.0`
SQL example:
+
```SQL
SELECT ST_ShiftLongitude(ST_GeomFromText('LINESTRING(177 10, 179 10, -179 10,
-177 10)'))
```
Output:
+
```sql
LINESTRING(177 10, 179 10, 181 10, 183 10)
```
@@ -2005,6 +2065,7 @@ For example, if a GeometryCollection of only Point
geometries is passed as a bla
Format: `ST_Split (input: geometry, blade: geometry)`
SQL Example:
+
```SQL
SELECT ST_Split(
ST_GeomFromWKT('LINESTRING (0 0, 1.5 1.5, 2 2)'),
@@ -2020,6 +2081,7 @@ Introduction: Return the spatial reference system
identifier (SRID) of the geome
Format: `ST_SRID (A:geometry)`
SQL example:
+
```SQL
SELECT ST_SRID(polygondf.countyshape)
FROM polygondf
@@ -2032,6 +2094,7 @@ Introduction: Returns first point of given linestring.
Format: `ST_StartPoint(geom: geometry)`
SQL example:
+
```SQL
SELECT ST_StartPoint(ST_GeomFromText('LINESTRING(100 150,50 60, 70 80, 160
170)'))
```
@@ -2045,12 +2108,14 @@ Introduction: Returns a multi-geometry divided based of
given maximum number of
Format: `ST_SubDivide(geom: geometry, maxVertices: int)`
SQL example:
+
```SQL
SELECT
Sedona.ST_AsText(Sedona.ST_SubDivide(Sedona.ST_GeomFromText('LINESTRING(0 0, 85
85, 100 100, 120 120, 21 21, 10 10, 5 5)'), 5));
```
Output:
+
```
MULTILINESTRING ((0 0, 5 5), (5 5, 10 10), (10 10, 21 21), (21 21, 60 60), (60
60, 85 85), (85 85, 100 100), (100 100, 120 120))
```
@@ -2066,6 +2131,7 @@ FROM table(SEDONA.ST_SubDivideExplode(geom: geometry,
maxVertices: int))`
Example:
Query:
+
```SQL
SELECT Sedona.ST_AsText(GEOM)
FROM table(Sedona.ST_SubDivideExplode(Sedona.ST_GeomFromText('LINESTRING(0 0,
85 85, 100 100, 120 120, 21 21, 10 10, 5 5)'), 5));
@@ -2121,12 +2187,14 @@ For SourceCRS and TargetCRS, WKT format is also
available.
Format: `ST_Transform (A:geometry, SourceCRS:string, TargetCRS:string
,[Optional] DisableError)`
SQL example (simple):
+
```SQL
SELECT ST_Transform(polygondf.countyshape, 'epsg:4326','epsg:3857')
FROM polygondf
```
SQL example (with optional parameters):
+
```SQL
SELECT ST_Transform(polygondf.countyshape, 'epsg:4326','epsg:3857', false)
FROM polygondf
@@ -2205,6 +2273,7 @@ Introduction: Returns X Coordinate of given Point null
otherwise.
Format: `ST_X(pointA: Point)`
SQL example:
+
```SQL
SELECT ST_X(ST_POINT(0.0 25.0))
```
@@ -2252,6 +2321,7 @@ Introduction: Returns Y Coordinate of given Point, null
otherwise.
Format: `ST_Y(pointA: Point)`
SQL example:
+
```SQL
SELECT ST_Y(ST_POINT(0.0 25.0))
```
@@ -2265,6 +2335,7 @@ Introduction: Return the minimum Y coordinate of A
Format: `ST_YMax (A:geometry)`
SQL example:
+
```SQL
SELECT ST_YMax(ST_GeomFromText('POLYGON((0 0 1, 1 1 1, 1 2 1, 1 1 1, 0 0 1))'))
```
@@ -2278,6 +2349,7 @@ Introduction: Return the minimum Y coordinate of A
Format: `ST_Y_Min (A:geometry)`
SQL example:
+
```SQL
SELECT ST_YMin(ST_GeomFromText('POLYGON((0 0 1, 1 1 1, 1 2 1, 1 1 1, 0 0 1))'))
```
@@ -2291,6 +2363,7 @@ Introduction: Returns Z Coordinate of given Point, null
otherwise.
Format: `ST_Z(pointA: Point)`
SQL example:
+
```SQL
SELECT ST_Z(ST_POINT(0.0 25.0 11.0))
```
@@ -2304,6 +2377,7 @@ Introduction: Returns Z maxima of the given geometry or
null if there is no Z co
Format: `ST_ZMax(geom: geometry)`
SQL example:
+
```SQL
SELECT ST_ZMax(ST_GeomFromText('POLYGON((0 0 1, 1 1 1, 1 2 1, 1 1 1, 0 0 1))'))
```
@@ -2317,6 +2391,7 @@ Introduction: Returns Z minima of the given geometry or
null if there is no Z co
Format: `ST_ZMin(geom: geometry)`
SQL example:
+
```SQL
SELECT ST_ZMin(ST_GeomFromText('LINESTRING(1 3 4, 5 6 7)'))
```
diff --git a/docs/api/sql/Constructor.md b/docs/api/sql/Constructor.md
index f330a0fb0..df4686669 100644
--- a/docs/api/sql/Constructor.md
+++ b/docs/api/sql/Constructor.md
@@ -54,6 +54,7 @@ Format:
Since: `v1.5.0`
SQL example:
+
```sql
SELECT ST_AsText(ST_GeomFromEWKT('SRID=4269;POINT(40.7128 -74.0060)'))
```
diff --git a/docs/api/sql/DataFrameAPI.md b/docs/api/sql/DataFrameAPI.md
index f8d2ef18f..a249c9a42 100644
--- a/docs/api/sql/DataFrameAPI.md
+++ b/docs/api/sql/DataFrameAPI.md
@@ -50,6 +50,7 @@ A short example of using this API (uses the `array_min` and
`array_max` Spark fu
```
The above code will generate the following dataframe:
+
```
+-----------+
|point |
@@ -66,6 +67,7 @@ df = df.select(stc.ST_Point(1.0, 3.0).alias("point"))
```
This will generate a dataframe with a constant point in a column:
+
```
+-----------+
|point |
diff --git a/docs/api/sql/Function.md b/docs/api/sql/Function.md
index 330d5512e..85ab6d7a4 100644
--- a/docs/api/sql/Function.md
+++ b/docs/api/sql/Function.md
@@ -212,11 +212,13 @@ Format: `ST_Area (A: Geometry)`
Since: `v1.0.0`
SQL Example
+
```sql
SELECT ST_Area(ST_GeomFromText("POLYGON(0 0, 0 10, 10 10, 0 10, 0 0)"))
```
Output:
+
```
10
```
@@ -533,6 +535,7 @@ Format: `ST_BoundingDiagonal(geom: Geometry)`
Since: `v1.5.0`
SQL Example
+
```sql
SELECT ST_BoundingDiagonal(ST_GeomFromWKT(geom))
```
@@ -588,9 +591,11 @@ Format:
```
ST_Buffer (A: Geometry, buffer: Double)
```
+
```
ST_Buffer (A: Geometry, buffer: Double, useSpheroid: Boolean)
```
+
```
ST_Buffer (A: Geometry, buffer: Double, useSpheroid: Boolean,
bufferStyleParameters: String)
```
@@ -681,6 +686,7 @@ Format: `ST_ClosestPoint(g1: Geometry, g2: Geometry)`
Since: `v1.5.0`
SQL Example
+
```sql
SELECT ST_AsText( ST_ClosestPoint(g1, g2)) As ptwkt;
```
@@ -1048,6 +1054,7 @@ Format: `ST_Dump(geom: Geometry)`
Since: `v1.0.0`
SQL Example
+
```sql
SELECT ST_Dump(ST_GeomFromText('MULTIPOINT ((10 40), (40 30), (20 20), (30
10))'))
```
@@ -1342,11 +1349,13 @@ Default parameters: `tolerance: 1e-6, maxIter: 1000,
failIfNotConverged: false`
Since: `v1.4.1`
SQL Example
+
```sql
SELECT ST_GeometricMedian(ST_GeomFromWKT('MULTIPOINT((0 0), (1 1), (2 2), (200
200))'))
```
Output:
+
```
POINT (1.9761550281255005 1.9761550281255005)
```
@@ -1404,11 +1413,13 @@ Format: `ST_H3CellDistance(cell1: Long, cell2: Long)`
Since: `v1.5.0`
SQL Example
+
```sql
select ST_H3CellDistance(ST_H3CellIDs(ST_GeomFromWKT('POINT(1 2)'), 8,
true)[0], ST_H3CellIDs(ST_GeomFromWKT('POINT(1.23 1.59)'), 8, true)[0])
```
Output:
+
```
+-----------------------------------------------------------------------------------------------------------------------------------------+
|st_h3celldistance(st_h3cellids(st_geomfromwkt(POINT(1 2), 0), 8, true)[0],
st_h3cellids(st_geomfromwkt(POINT(1.23 1.59), 0), 8, true)[0])|
@@ -1451,11 +1462,13 @@ Format: `ST_H3CellIDs(geom: geometry, level: Int,
fullCover: Boolean)`
Since: `v1.5.0`
SQL Example
+
```sql
SELECT ST_H3CellIDs(ST_GeomFromText('LINESTRING(1 3 4, 5 6 7)'), 6, true)
```
Output:
+
```
+-------------------------------------------------------------+
|st_h3cellids(st_geomfromtext(LINESTRING(1 3 4, 5 6 7), 0), 6)|
@@ -1478,11 +1491,13 @@ Format: `ST_H3KRing(cell: Long, k: Int, exactRing:
Boolean)`
Since: `v1.5.0`
SQL Example
+
```sql
SELECT ST_H3KRing(ST_H3CellIDs(ST_GeomFromWKT('POINT(1 2)'), 8, true)[0], 1,
true) cells union select ST_H3KRing(ST_H3CellIDs(ST_GeomFromWKT('POINT(1 2)'),
8, true)[0], 1, false) cells
```
Output:
+
```
+--------------------------------------------------------------------------------------------------------------------------------------------+
|cells
|
@@ -1508,11 +1523,13 @@ Format: `ST_H3ToGeom(cells: Array[Long])`
Since: `v1.6.0`
Example:
+
```sql
SELECT ST_H3ToGeom(ST_H3CellIDs(ST_GeomFromWKT('POINT(1 2)'), 8, true)[0], 1,
true))
```
Output:
+
```
[POLYGON ((1.0057629565405093 1.9984665139177547, 1.0037116327309097
2.0018325249140068, 0.999727799357053 2.001163270465665, 0.9977951427833316
1.997128228393235, 0.9998461908217928 1.993762152933182, 1.0038301712104316
1.9944311839965523, 1.0057629565405093 1.9984665139177547))]
```
@@ -1768,9 +1785,11 @@ Introduction: Test if a geometry is well-formed. The
function can be invoked wit
- 1: "ESRI flag", Accepts certain self-touching rings as valid, which are
considered invalid under OGC standards.
Formats:
+
```
ST_IsValid (A: Geometry)
```
+
```
ST_IsValid (A: Geometry, flag: Integer)
```
@@ -1797,9 +1816,11 @@ Introduction: Returns text stating if the geometry is
valid. If not, it provides
- 1: "ESRI flag", Accepts certain self-touching rings as valid, which are
considered invalid under OGC standards.
Formats:
+
```
ST_IsValidReason (A: Geometry)
```
+
```
ST_IsValidReason (A: Geometry, flag: Integer)
```
@@ -1918,6 +1939,7 @@ SELECT
ST_LineInterpolatePoint(ST_GeomFromWKT('LINESTRING(25 50, 100 125, 150 19
```
Output:
+
```
POINT (51.5974135047432 76.5974135047432)
```
@@ -1937,6 +1959,7 @@ SELECT ST_LineLocatePoint(ST_GeomFromWKT('LINESTRING(0 0,
1 1, 2 2)'), ST_GeomFr
```
Output:
+
```
0.5
```
@@ -2069,6 +2092,7 @@ WITH linestring AS (
```
Result:
+
```
+------------------+------------------------+
|st_makevalid(geom)|st_makevalid(geom, true)|
@@ -2325,6 +2349,7 @@ Format: `ST_PointN(geom: Geometry, n: Integer)`
Since: `v1.2.1`
SQL Example
+
```sql
SELECT ST_PointN(ST_GeomFromText("LINESTRING(0 0, 1 2, 2 4, 3 6)"), 2)
```
@@ -2402,6 +2427,7 @@ SQL Example
SELECT ST_ReducePrecision(ST_GeomFromWKT('Point(0.1234567890123456789
0.1234567890123456789)')
, 9)
```
+
The new coordinates will only have 9 decimal places.
Output:
@@ -2471,6 +2497,7 @@ SELECT ST_S2CellIDs(ST_GeomFromText('LINESTRING(1 3 4, 5
6 7)'), 6)
```
Output:
+
```
[1159395429071192064, 1159958379024613376, 1160521328978034688,
1161084278931456000, 1170091478186196992, 1170654428139618304]
```
@@ -2552,11 +2579,13 @@ Format: `ST_ShiftLongitude (geom: geometry)`
Since: `v1.6.0`
SQL example:
+
```SQL
SELECT ST_ShiftLongitude(ST_GeomFromText('LINESTRING(177 10, 179 10, -179 10,
-177 10)'))
```
Output:
+
```sql
LINESTRING(177 10, 179 10, 181 10, 183 10)
```
@@ -2691,12 +2720,14 @@ Format: `ST_SubDivide(geom: Geometry, maxVertices:
Integer)`
Since: `v1.1.0`
SQL Example
+
```sql
SELECT ST_SubDivide(ST_GeomFromText("POLYGON((35 10, 45 45, 15 40, 10 20, 35
10), (20 30, 35 35, 30 20, 20 30))"), 5)
```
Output:
+
```
[
POLYGON((37.857142857142854 20, 35 10, 10 20, 37.857142857142854 20)),
@@ -2723,6 +2754,7 @@ SELECT ST_SubDivide(ST_GeomFromText("LINESTRING(0 0, 85
85, 100 100, 120 120, 21
```
Output:
+
```
[
LINESTRING(0 0, 5 5)
@@ -2746,6 +2778,7 @@ Since: `v1.1.0`
SQL Example
Query:
+
```sql
SELECT ST_SubDivideExplode(ST_GeomFromText("LINESTRING(0 0, 85 85, 100 100,
120 120, 21 21, 10 10, 5 5)"), 5)
```
@@ -2769,6 +2802,7 @@ Result:
Using Lateral View
Table:
+
```
+-------------------------------------------------------------+
|geometry |
@@ -2778,11 +2812,13 @@ Table:
```
Query
+
```sql
select geom from geometries LATERAL VIEW ST_SubdivideExplode(geometry, 5) AS
geom
```
Result:
+
```
+-----------------------------+
|geom |
@@ -3102,6 +3138,7 @@ Format: `ST_YMax (A: Geometry)`
Since: `v1.2.1`
SQL Example
+
```sql
SELECT ST_YMax(ST_GeomFromText('POLYGON((0 0 1, 1 1 1, 1 2 1, 1 1 1, 0 0 1))'))
```
diff --git a/docs/api/sql/Optimizer.md b/docs/api/sql/Optimizer.md
index 98fc12f95..39492ff53 100644
--- a/docs/api/sql/Optimizer.md
+++ b/docs/api/sql/Optimizer.md
@@ -58,6 +58,7 @@ Introduction: Find geometries from A and geometries from B
such that the distanc
Spark SQL Example for planar Euclidean distance:
*Only consider ==fully within a certain distance==*
+
```sql
SELECT *
FROM pointdf1, pointdf2
@@ -77,6 +78,7 @@ WHERE ST_FrechetDistance(pointDf.pointshape,
polygonDf.polygonshape) < 2
```
*Consider ==intersects within a certain distance==*
+
```sql
SELECT *
FROM pointdf1, pointdf2
@@ -96,6 +98,7 @@ WHERE ST_FrechetDistance(pointDf.pointshape,
polygonDf.polygonshape) <= 2
```
Spark SQL Physical plan:
+
```
== Physical Plan ==
DistanceJoin pointshape1#12: geometry, pointshape2#33: geometry, 2.0, true
@@ -111,6 +114,7 @@ DistanceJoin pointshape1#12: geometry, pointshape2#33:
geometry, 2.0, true
Spark SQL Example for meter-based geodesic distance `ST_DistanceSpheroid`
(works for `ST_DistanceSphere` too):
*Less than a certain distance==*
+
```sql
SELECT *
FROM pointdf1, pointdf2
@@ -118,6 +122,7 @@ WHERE
ST_DistanceSpheroid(pointdf1.pointshape1,pointdf2.pointshape2) < 2
```
*Less than or equal to a certain distance==*
+
```sql
SELECT *
FROM pointdf1, pointdf2
@@ -147,6 +152,7 @@
pointDf.alias("pointDf").join(broadcast(polygonDf).alias("polygonDf"), expr("ST_
```
Spark SQL Physical plan:
+
```
== Physical Plan ==
BroadcastIndexJoin pointshape#52: geometry, BuildRight, BuildRight, false
ST_Contains(polygonshape#30, pointshape#52)
@@ -164,6 +170,7 @@
pointDf1.alias("pointDf1").join(broadcast(pointDf2).alias("pointDf2"), expr("ST_
```
Spark SQL Physical plan:
+
```
== Physical Plan ==
BroadcastIndexJoin pointshape#52: geometry, BuildRight, BuildLeft, true, 2.0
ST_Distance(pointshape#52, pointshape#415) <= 2.0
diff --git a/docs/api/sql/Overview.md b/docs/api/sql/Overview.md
index 0a1c2f96c..a4c577cde 100644
--- a/docs/api/sql/Overview.md
+++ b/docs/api/sql/Overview.md
@@ -3,11 +3,13 @@
## Function list
SedonaSQL supports SQL/MM Part3 Spatial SQL Standard. It includes four kinds
of SQL operators as follows. All these operators can be directly called through:
+
```scala
var myDataFrame = sedona.sql("YOUR_SQL")
```
Alternatively, `expr` and `selectExpr` can be used:
+
```scala
myDataFrame.withColumn("geometry", expr("ST_*")).selectExpr("ST_*")
```
@@ -35,13 +37,16 @@ The detailed explanation is here [Write a SQL/DataFrame
application](../../tutor
1. Add Sedona-core and Sedona-SQL into your project pom.xml or build.sbt
2. Create your Sedona config if you want to customize your SparkSession.
+
```scala
import org.apache.sedona.spark.SedonaContext
val config = SedonaContext.builder().
master("local[*]").appName("SedonaSQL")
.getOrCreate()
```
+
3. Add the following line after your Sedona context declaration:
+
```scala
import org.apache.sedona.spark.SedonaContext
val sedona = SedonaContext.create(config)
diff --git a/docs/api/sql/Parameter.md b/docs/api/sql/Parameter.md
index 4ce7beefd..b84b7cdee 100644
--- a/docs/api/sql/Parameter.md
+++ b/docs/api/sql/Parameter.md
@@ -3,6 +3,7 @@
SedonaSQL supports many parameters. To change their values,
1. Set it through SparkConf:
+
```scala
sparkSession = SparkSession.builder().
config("spark.serializer","org.apache.spark.serializer.KryoSerializer").
@@ -10,12 +11,16 @@ sparkSession = SparkSession.builder().
config("sedona.global.index","true")
master("local[*]").appName("mySedonaSQLdemo").getOrCreate()
```
+
2. Check your current SedonaSQL configuration:
+
```scala
val sedonaConf = new SedonaConf(sparkSession.conf)
println(sedonaConf)
```
+
3. Sedona parameters can be changed at runtime:
+
```scala
sparkSession.conf.set("sedona.global.index","false")
```
diff --git a/docs/api/sql/Predicate.md b/docs/api/sql/Predicate.md
index 7a245254a..417f0114d 100644
--- a/docs/api/sql/Predicate.md
+++ b/docs/api/sql/Predicate.md
@@ -93,6 +93,7 @@ SELECT ST_DWithin(ST_GeomFromWKT(-122.335167 47.608013),
ST_GeomFromWKT(-73.9352
```
Output:
+
```
true
```
diff --git a/docs/api/sql/Raster-loader.md b/docs/api/sql/Raster-loader.md
index f8b810db1..713d480e8 100644
--- a/docs/api/sql/Raster-loader.md
+++ b/docs/api/sql/Raster-loader.md
@@ -157,6 +157,7 @@ SELECT RS_MakeEmptyRaster(2, 'F', 10, 10, 0.0, 0.0, 1.0,
-1.0, 0.0, 0.0, 4326) -
```
Output:
+
```
+------------------------------------------------------------------+
|rs_makeemptyraster(2, 10, 10, 0.0, 0.0, 1.0, -1.0, 0.0, 0.0, 4326)|
diff --git a/docs/api/sql/Raster-operators.md b/docs/api/sql/Raster-operators.md
index 6be9238cb..1a1808118 100644
--- a/docs/api/sql/Raster-operators.md
+++ b/docs/api/sql/Raster-operators.md
@@ -32,11 +32,13 @@ Format: `RS_PixelAsCentroids(raster: Raster, band: Integer)`
Since: `v1.5.1`
SQL Example
+
```sql
SELECT ST_AsText(RS_PixelAsCentroids(raster, 1)) from rasters
```
Output:
+
```
[[POINT (-13065222 4021263.75),148.0,0,0], [POINT (-13065151
4021263.75),123.0,0,1], [POINT (-13065077 4021263.75),99.0,1,0], [POINT
(-13065007 4021261.75),140.0,1,1]]
```
@@ -89,6 +91,7 @@ SELECT ST_AsText(RS_PixelAsPoint(raster, 2, 1)) from rasters
```
Output:
+
```
POINT (123.19, -12)
```
@@ -100,6 +103,7 @@ SELECT ST_AsText(RS_PixelAsPoint(raster, 6, 2)) from rasters
```
Output:
+
```
IndexOutOfBoundsException: Specified pixel coordinates (6, 2) do not lie in
the raster
```
@@ -113,11 +117,13 @@ Format: `RS_PixelAsPoints(raster: Raster, band: Integer)`
Since: `v1.5.1`
SQL Example
+
```sql
SELECT ST_AsText(RS_PixelAsPoints(raster, 1)) from rasters
```
Output:
+
```
[[POINT (-13065223 4021262.75),148.0,0,0], [POINT (-13065150
4021262.75),123.0,0,1], [POINT (-13065078 4021262.75),99.0,1,0], [POINT
(-13065006 4021262.75),140.0,1,1]]
```
@@ -183,11 +189,13 @@ Format: `RS_PixelAsPolygons(raster: Raster, band:
Integer)`
Since: `v1.5.1`
SQL Example
+
```sql
SELECT ST_AsText(RS_PixelAsPolygons(raster, 1)) from rasters
```
Output:
+
```
[[POLYGON ((123.19000244140625 -12, 127.19000244140625 -12, 127.19000244140625
-16, 123.19000244140625 -16, 123.19000244140625 -12)),0.0,1,1],
[POLYGON ((127.19000244140625 -12, 131.19000244140625 -12, 131.19000244140625
-16, 127.19000244140625 -16, 127.19000244140625 -12)),0.0,2,1],
@@ -294,6 +302,7 @@
inputDf.selectExpr("ST_AsText(RS_MinConvexHull(RS_AddBandFromArray(" +
```
Output:
+
```sql
+----------------------------------------+
|minConvexHullAll |
@@ -312,6 +321,7 @@
inputDf.selectExpr("ST_AsText(RS_MinConvexHull(RS_AddBandFromArray(" +
```
Output:
+
```sql
+----------------------------------------+
|minConvexHull1 |
@@ -617,6 +627,7 @@ SELECT RS_ScaleY(raster) FROM rasters
```
Output:
+
```
-2
```
@@ -716,6 +727,7 @@ SELECT RS_Width(raster) FROM rasters
```
Output:
+
```
517
```
@@ -1280,6 +1292,7 @@ SELECT RS_Contains(RS_MakeEmptyRaster(1, 20, 20, 2, 22,
1), ST_GeomFromWKT('POLY
```
Output:
+
```
+---------+---------+
|rast_geom|rast_rast|
@@ -1349,6 +1362,7 @@ SELECT RS_Within(RS_MakeEmptyRaster(1, 20, 20, 2, 22, 1),
ST_GeomFromWKT('POLYGO
```
Output:
+
```
+---------+---------+
|rast_geom|rast_rast|
@@ -1470,18 +1484,23 @@ Formats:
```sql
RS_Interpolate(raster: Raster)
```
+
```sql
RS_Interpolate(raster: Raster, power: Double)
```
+
```sql
RS_Interpolate(raster: Raster, power: Double, mode: String)
```
+
```sql
RS_Interpolate(raster: Raster, power: Double, mode: String, numPointsOrRadius:
Double)
```
+
```sql
RS_Interpolate(raster: Raster, power: Double, mode: String, numPointsOrRadius:
Double, maxRadiusOrMinPoints: Double)
```
+
```sql
RS_Interpolate(raster: Raster, power: Double, mode: String, numPointsOrRadius:
Double, maxRadiusOrMinPoints: Double, band: Integer)
```
@@ -1559,21 +1578,27 @@ A Safety mode is triggered when `noDataValue` is not
given. This sets `noDataVal
Using a noDataValue that falls within the normalization range can lead to
loss of valid data. If any data value within a raster band matches the
specified noDataValue, it will be replaced and cannot be distinguished or
recovered later. Exercise caution in selecting a noDataValue to avoid
unintentional data alteration.
Formats:
+
```
RS_NormalizeAll (raster: Raster)
```
+
```
RS_NormalizeAll (raster: Raster, minLim: Double, maxLim: Double)
```
+
```
RS_NormalizeAll (raster: Raster, minLim: Double, maxLim: Double,
normalizeAcrossBands: Boolean)
```
+
```
RS_NormalizeAll (raster: Raster, minLim: Double, maxLim: Double,
normalizeAcrossBands: Boolean, noDataValue: Double)
```
+
```
RS_NormalizeAll (raster: Raster, minLim: Double, maxLim: Double, noDataValue:
Double, minValue: Double, maxValue: Double)
```
+
```
RS_NormalizeAll (raster: Raster, minLim: Double, maxLim: Double,
normalizeAcrossBands: Boolean, noDataValue: Double, minValue: Double, maxValue:
Double )
```
@@ -1914,6 +1939,7 @@ The `dataType` parameter accepts one of the following
strings.
If the specified `dataType` is narrower than the original data type, the
function will truncate the pixel values to fit the new data type range.
Format:
+
```
RS_SetPixelType(raster: Raster, dataType: String)
```
@@ -2359,6 +2385,7 @@ SELECT RS_AddBandFromArray(raster,
RS_MultiplyFactor(RS_BandAsArray(RS_FromGeoTi
```
Output:
+
```
+--------------------+
| raster|
@@ -2401,6 +2428,7 @@ SELECT RS_MapAlgebra(rast, 'D', 'out = (rast[3] -
rast[0]) / (rast[3] + rast[0])
```
Output:
+
```
+--------------------+
| raster|
diff --git a/docs/api/sql/Raster-visualizer.md
b/docs/api/sql/Raster-visualizer.md
index 7df0a6c6f..c1598cd45 100644
--- a/docs/api/sql/Raster-visualizer.md
+++ b/docs/api/sql/Raster-visualizer.md
@@ -132,6 +132,7 @@
print(inputDf.selectExpr("RS_AsMatrix(RS_AddBandFromArray(RS_MakeEmptyRaster(1,
```
Output:
+
```sql
| 1 3 4 0|
| 2 9 10 11|
diff --git a/docs/api/sql/Visualization_SedonaKepler.md
b/docs/api/sql/Visualization_SedonaKepler.md
index b76a0a214..d4de2c69d 100644
--- a/docs/api/sql/Visualization_SedonaKepler.md
+++ b/docs/api/sql/Visualization_SedonaKepler.md
@@ -1,11 +1,13 @@
SedonaKepler offers a number of APIs which aid in quick and interactive
visualization of a geospatial data in a Jupyter notebook/lab environment.
Inorder to start using SedonaKepler, simply import Sedona using:
+
```python
from sedona.spark import *
```
Alternatively it can also be imported using:
+
```python
from sedona.maps.SedonaKepler import SedonaKepler
```
diff --git a/docs/api/sql/Visualization_SedonaPyDeck.md
b/docs/api/sql/Visualization_SedonaPyDeck.md
index 26e555cce..d8b9d07eb 100644
--- a/docs/api/sql/Visualization_SedonaPyDeck.md
+++ b/docs/api/sql/Visualization_SedonaPyDeck.md
@@ -1,11 +1,13 @@
SedonaPyDeck offers a number of APIs which aid in quick and interactive
visualization of a geospatial data in a Jupyter notebook/lab environment.
Inorder to start using SedonaPyDeck, simply import Sedona using:
+
```python
from sedona.spark import *
```
Alternatively it can also be imported using:
+
```python
from sedona.maps.SedonaPyDeck import SedonaPyDeck
```
@@ -39,6 +41,7 @@ def create_choropleth_map(df, fill_color=None, plot_col=None,
initial_view_state
The parameter `fill_color` can be given a list of RGB/RGBA values, or a string
that contains RGB/RGBA values based on a column.
For example, all these are valid values of fill_color:
+
```python
fill_color=[255, 12, 250]
fill_color=[0, 12, 250, 255]
diff --git a/docs/api/viz/sql.md b/docs/api/viz/sql.md
index 67582cec0..015019761 100644
--- a/docs/api/viz/sql.md
+++ b/docs/api/viz/sql.md
@@ -4,13 +4,16 @@ The detailed explanation is here: [Visualize Spatial
DataFrame/RDD](../../tutori
1. Add Sedona-core, Sedona-SQL, Sedona-Viz into your project pom.xml or
build.sbt
2. Declare your Spark Session
+
```scala
sparkSession = SparkSession.builder().
config("spark.serializer","org.apache.spark.serializer.KryoSerializer").
config("spark.kryo.registrator",
"org.apache.sedona.viz.core.Serde.SedonaVizKryoRegistrator").
master("local[*]").appName("mySedonaVizDemo").getOrCreate()
```
+
3. Add the following lines after your SparkSession declaration:
+
```scala
SedonaSQLRegistrator.registerAll(sparkSession)
SedonaVizRegistrator.registerAll(sparkSession)
@@ -38,6 +41,7 @@ Since: `v1.0.0`
This function will normalize the weight according to the max weight among all
pixels. Different pixel obtains different color.
SQL Example
+
```sql
SELECT pixels.px, ST_Colorize(pixels.weight, 999) AS color
FROM pixels
@@ -55,6 +59,7 @@ FROM pixels
```
Here are some example color names can be entered:
+
```
"firebrick"
"#aa38e0"
diff --git a/docs/community/publish.md b/docs/community/publish.md
index 6c05fddc6..69d95cb10 100644
--- a/docs/community/publish.md
+++ b/docs/community/publish.md
@@ -8,10 +8,12 @@ This page is for Sedona PMC to publish Sedona releases.
## 0. Prepare an empty script file
1. In your local Sedona Git repo under master branch, run
+
```bash
echo '#!/bin/bash' > create-release.sh
chmod 777 create-release.sh
```
+
2. Use your favourite GUI text editor to open `create-release.sh`.
3. Then keep copying the scripts on this web page to replace all content in
this script file.
4. Do NOT directly copy/paste the scripts to your terminal because a bug in
`clipboard.js` will create link breaks in such case.
@@ -20,6 +22,7 @@ chmod 777 create-release.sh
## 1. Check ASF copyright in all file headers
1. Run the following script:
+
```bash
#!/bin/bash
wget -q
https://archive.apache.org/dist/creadur/apache-rat-0.15/apache-rat-0.15-bin.tar.gz
@@ -27,8 +30,10 @@ tar -xvf apache-rat-0.15-bin.tar.gz
git clone --shared --branch master https://github.com/apache/sedona.git
sedona-src
java -jar apache-rat-0.15/apache-rat-0.15.jar -d sedona-src > report.txt
```
+
2. Read the generated report.txt file and make sure all source code files have
ASF header.
3. Delete the generated report and cloned files
+
```bash
#!/bin/bash
rm -rf apache-rat-0.15
diff --git a/docs/community/release-manager.md
b/docs/community/release-manager.md
index 83b451a50..9a27c5833 100644
--- a/docs/community/release-manager.md
+++ b/docs/community/release-manager.md
@@ -13,15 +13,19 @@ If your Maven (`mvn --version`) points to other JDK
versions, you must change it
1. Find all Java installed on your machine: `/usr/libexec/java_home -V`. You
should see multiple JDK versions including JDK 8.
2. Run `whereis mvn` to get the installation location of your Maven. The
result is a symlink to the actual location.
3. Open it in the terminal (with `sudo` if needed). It will be like this
+
```
#!/bin/bash
JAVA_HOME="${JAVA_HOME:-$(/usr/libexec/java_home)}" exec
"/usr/local/Cellar/maven/3.6.3/libexec/bin/mvn" "$@"
```
+
4. Change `JAVA_HOME:-$(/usr/libexec/java_home)}` to
`JAVA_HOME:-$(/usr/libexec/java_home -v 1.8)}`. The resulting content will be
like this:
+
```
#!/bin/bash
JAVA_HOME="${JAVA_HOME:-$(/usr/libexec/java_home -v 1.8)}" exec
"/usr/local/Cellar/maven/3.6.3/libexec/bin/mvn" "$@"
```
+
5. Run `mvn --version` again. It should now point to JDK 8.
### 1. Obtain Write Access to Sedona GitHub repo
@@ -59,18 +63,23 @@ Use SVN to append your armored PGP public key to the `KEYS`
files
* https://dist.apache.org/repos/dist/release/sedona/KEYS
1. Check out both KEYS files
+
```bash
svn checkout https://dist.apache.org/repos/dist/dev/sedona/ sedona-dev --depth
files
svn checkout https://dist.apache.org/repos/dist/release/sedona/ sedona-release
--depth files
```
+
2. Use your favorite text editor to open `sedona-dev/KEYS` and
`sedona-release/KEYS`.
3. Paste your armored key to the end of both files. Note: There must be an
empty line between `-----BEGIN PGP PUBLIC KEY BLOCK-----` and the actual key.
4. Commit both KEYS. SVN might ask you to enter your ASF ID and password. Make
sure you do it so SVN can always store your ID and password locally.
+
```bash
svn commit -m "Update KEYS" sedona-dev/KEYS
svn commit -m "Update KEYS" sedona-release/KEYS
```
+
5. Then remove both svn folders
+
```bash
rm -rf sedona-dev
rm -rf sedona-release
diff --git a/docs/community/snapshot.md b/docs/community/snapshot.md
index 8dbed0ce7..88be2bc85 100644
--- a/docs/community/snapshot.md
+++ b/docs/community/snapshot.md
@@ -12,10 +12,12 @@ The detailed requirement is on [ASF Infra
website](https://infra.apache.org/publ
## 0. Prepare an empty script file
1. In your local Sedona Git repo under master branch, run
+
```bash
echo '#!/bin/bash' > create-release.sh
chmod 777 create-release.sh
```
+
2. Use your favourite GUI text editor to open `create-release.sh`.
3. Then keep copying the scripts on this web page to replace all content in
this text file.
4. Do NOT directly copy/paste the scripts to your terminal because a bug in
`clipboard.js` will create link breaks in such case.
diff --git a/docs/setup/compile.md b/docs/setup/compile.md
index 49e627775..19f2fc278 100644
--- a/docs/setup/compile.md
+++ b/docs/setup/compile.md
@@ -69,11 +69,14 @@ Sedona uses GitHub Actions to automatically generate jars
per commit. You can go
1. Set up the environment variable SPARK_HOME and PYTHONPATH
For example,
+
```
export SPARK_HOME=$PWD/spark-3.0.1-bin-hadoop2.7
export PYTHONPATH=$SPARK_HOME/python
```
+
2. Put JAI jars to ==SPARK_HOME/jars/== folder.
+
```
export JAI_CORE_VERSION="1.1.3"
export JAI_CODEC_VERSION="1.1.3"
@@ -82,11 +85,15 @@ wget -P $SPARK_HOME/jars/
https://repo.osgeo.org/repository/release/javax/media/
wget -P $SPARK_HOME/jars/
https://repo.osgeo.org/repository/release/javax/media/jai_codec/${JAI_CODEC_VERSION}/jai_codec-${JAI_CODEC_VERSION}.jar
wget -P $SPARK_HOME/jars/
https://repo.osgeo.org/repository/release/javax/media/jai_imageio/${JAI_IMAGEIO_VERSION}/jai_imageio-${JAI_IMAGEIO_VERSION}.jar
```
+
3. Compile the Sedona Scala and Java code with `-Dgeotools` and then copy the
==sedona-spark-shaded-{{ sedona.current_version }}.jar== to
==SPARK_HOME/jars/== folder.
+
```
cp spark-shaded/target/sedona-spark-shaded-xxx.jar $SPARK_HOME/jars/
```
+
4. Install the following libraries
+
```
sudo apt-get -y install python3-pip python-dev libgeos-dev
sudo pip3 install -U setuptools
@@ -94,21 +101,27 @@ sudo pip3 install -U wheel
sudo pip3 install -U virtualenvwrapper
sudo pip3 install -U pipenv
```
+
Homebrew can be used to install libgeos-dev in macOS: `brew install geos`
5. Set up pipenv to the desired Python version: 3.7, 3.8, or 3.9
+
```
cd python
pipenv --python 3.7
```
+
6. Install the PySpark version and the other dependency
+
```
cd python
pipenv install pyspark
pipenv install --dev
```
+
`pipenv install pyspark` installs the latest version of pyspark.
In order to remain consistent with the installed spark version, use `pipenv
install pyspark==<spark_version>`
7. Run the Python tests
+
```
cd python
pipenv run python setup.py build_ext --inplace
diff --git a/docs/setup/databricks.md b/docs/setup/databricks.md
index 34fec7a28..ea86d37f2 100644
--- a/docs/setup/databricks.md
+++ b/docs/setup/databricks.md
@@ -28,12 +28,14 @@ This method cannot achieve the best performance of Sedona
and does not work for
### Install libraries
1) From the Libraries tab install from Maven Coordinates
+
```
org.apache.sedona:sedona-spark-shaded-3.0_2.12:{{ sedona.current_version }}
org.datasyslab:geotools-wrapper:{{ sedona.current_geotools }}
```
2) For enabling python support, from the Libraries tab install from PyPI
+
```
apache-sedona
keplergl==0.3.2
@@ -45,12 +47,14 @@ This method cannot achieve the best performance of Sedona
and does not work for
After you have installed the libraries and started the cluster, you can
initialize the Sedona `ST_*` functions and types by running from your code:
(scala)
+
```scala
import org.apache.sedona.sql.utils.SedonaSQLRegistrator
SedonaSQLRegistrator.registerAll(spark)
```
(or python)
+
```python
from sedona.register.geo_registrator import SedonaRegistrator
SedonaRegistrator.registerAll(spark)
@@ -107,6 +111,7 @@ EOF
### Set up cluster config
From your cluster configuration (`Cluster` -> `Edit` -> `Configuration` ->
`Advanced options` -> `Spark`) activate the Sedona functions and the kryo
serializer by adding to the Spark Config
+
```
spark.sql.extensions
org.apache.sedona.viz.sql.SedonaVizExtensions,org.apache.sedona.sql.SedonaSqlExtensions
spark.serializer org.apache.spark.serializer.KryoSerializer
@@ -114,11 +119,13 @@ spark.kryo.registrator
org.apache.sedona.core.serde.SedonaKryoRegistrator
```
From your cluster configuration (`Cluster` -> `Edit` -> `Configuration` ->
`Advanced options` -> `Init Scripts`) add the newly created `Workspace` init
script
+
```
/Workspace/sedona/sedona-init.sh
```
For enabling python support, from the Libraries tab install from PyPI
+
```
apache-sedona=={{ sedona.current_version }}
geopandas==0.11.1
diff --git a/docs/setup/docker.md b/docs/setup/docker.md
index d510651dd..f5a4f21b5 100644
--- a/docs/setup/docker.md
+++ b/docs/setup/docker.md
@@ -33,6 +33,7 @@ Format:
```bash
docker run -e DRIVER_MEM=<driver_mem> -e EXECUTOR_MEM=<executor_mem> -p
8888:8888 -p 8080:8080 -p 8081:8081 -p 4040:4040 apache/sedona:<sedona_version>
```
+
Driver memory and executor memory are optional. If their values are not given,
the container will take 4GB RAM for the driver and 4GB RAM for the executor.
Example 1:
diff --git a/docs/setup/flink/install-scala.md
b/docs/setup/flink/install-scala.md
index 611541411..554e8e7cf 100644
--- a/docs/setup/flink/install-scala.md
+++ b/docs/setup/flink/install-scala.md
@@ -8,6 +8,7 @@ To use Sedona in your self-contained Flink project, you just
need to add Sedona
2. Read [Sedona Flink guide](../../../tutorial/flink/sql) and use Sedona
Template project to start: [Sedona Template Project](../../../tutorial/demo/)
3. Compile your project using Maven. Make sure you obtain the fat jar which
packages all dependencies.
4. Submit your compiled fat jar to Flink cluster. Make sure you are in the
root folder of Flink distribution. Then run the following command:
+
```
./bin/flink run /Path/To/YourJar.jar
```
diff --git a/docs/setup/install-scala.md b/docs/setup/install-scala.md
index 3bd9dcc9a..4289d3d31 100644
--- a/docs/setup/install-scala.md
+++ b/docs/setup/install-scala.md
@@ -12,9 +12,11 @@ There are two ways to use a Scala or Java library with
Apache Spark. You can use
1. Have your Spark cluster ready.
2. Run Spark shell with `--packages` option. This command will automatically
download Sedona jars from Maven Central.
+
```
./bin/spark-shell --packages MavenCoordinates
```
+
Please refer to [Sedona Maven Central coordinates](maven-coordinates.md) to
select the corresponding Sedona packages for your Spark version.
* Local mode: test Sedona without setting up a cluster
@@ -35,9 +37,11 @@ Please refer to [Sedona Maven Central
coordinates](maven-coordinates.md) to sele
* Download the pre-compiled jars from [Sedona Releases](../download.md)
* Download / Git clone Sedona source code and compile the code by
yourself (see [Compile Sedona](../compile))
3. Run Spark shell with `--jars` option.
+
```
./bin/spark-shell --jars /Path/To/SedonaJars.jar
```
+
If you are using Spark 3.0 to 3.3, please use jars with filenames containing
`3.0`, such as `sedona-spark-shaded-3.0_2.12-{{ sedona.current_version }}`; If
you are using Spark 3.4 or higher versions, please use jars with Spark
major.minor versions in the filename, such as `sedona-spark-shaded-3.4_2.12-{{
sedona.current_version }}`.
* Local mode: test Sedona without setting up a cluster
@@ -62,6 +66,7 @@ A self-contained project allows you to create multiple Scala
/ Java files and wr
2. Use Sedona Template project to start: [Sedona Template
Project](../../tutorial/demo/)
3. Compile your project using SBT. Make sure you obtain the fat jar which
packages all dependencies.
4. Submit your compiled fat jar to Spark cluster. Make sure you are in the
root folder of Spark distribution. Then run the following command:
+
```
./bin/spark-submit --master spark://YOUR-IP:7077 /Path/To/YourJar.jar
```
diff --git a/docs/setup/release-notes.md b/docs/setup/release-notes.md
index 5b053fab3..ae587d85d 100644
--- a/docs/setup/release-notes.md
+++ b/docs/setup/release-notes.md
@@ -445,12 +445,15 @@ Sedona 1.4.1 is compiled against Spark 3.3 / Spark 3.4 /
Flink 1.12, Java 8.
* **Sedona Spark & Flink** Introduced a new entry point called SedonaContext
to unify all Sedona entry points in different compute engines and deprecate old
Sedona register entry points. Users no longer have to register Sedona kryo
serializer and import many tedious Python classes.
* **Sedona Spark**:
* Scala:
+
```scala
import org.apache.sedona.spark.SedonaContext
val sedona =
SedonaContext.create(SedonaContext.builder().master("local[*]").getOrCreate())
sedona.sql("SELECT ST_GeomFromWKT(XXX) FROM")
```
+
* Python:
+
```python
from sedona.spark import *
@@ -462,7 +465,9 @@ Sedona 1.4.1 is compiled against Spark 3.3 / Spark 3.4 /
Flink 1.12, Java 8.
sedona = SedonaContext.create(config)
sedona.sql("SELECT ST_GeomFromWKT(XXX) FROM")
```
+
* **Sedona Flink**:
+
```java
import org.apache.sedona.flink.SedonaContext
StreamTableEnvironment sedona = SedonaContext.create(env, tableEnv);
diff --git a/docs/tutorial/Advanced-Tutorial-Tune-your-Application.md
b/docs/tutorial/Advanced-Tutorial-Tune-your-Application.md
index cb8fea2d2..4517e5240 100644
--- a/docs/tutorial/Advanced-Tutorial-Tune-your-Application.md
+++ b/docs/tutorial/Advanced-Tutorial-Tune-your-Application.md
@@ -17,10 +17,13 @@ The third level (i.e., 0.8.1) tells that this version only
contains bug fixes, s
Sedona provides a number of constructors for each SpatialRDD (PointRDD,
PolygonRDD and LineStringRDD). In general, you have two options to start with.
1. Initialize a SpatialRDD from your data source such as HDFS and S3. A
typical example is as follows:
+
```java
public PointRDD(JavaSparkContext sparkContext, String InputLocation, Integer
Offset, FileDataSplitter splitter, boolean carryInputData, Integer partitions,
StorageLevel newLevel)
```
+
2. Initialize a SpatialRDD from an existing RDD. A typical example is as
follows:
+
```java
public PointRDD(JavaRDD<Point> rawSpatialRDD, StorageLevel newLevel)
```
@@ -32,6 +35,7 @@ However, in some cases, you may know well about your
datasets. If so, you can ma
```java
public PointRDD(JavaSparkContext sparkContext, String InputLocation, Integer
Offset, FileDataSplitter splitter, boolean carryInputData, Integer partitions,
Envelope datasetBoundary, Integer approximateTotalCount) {
```
+
Manually providing the dataset boundary and approximate total count helps
Sedona avoiding several slow "Action"s during initialization.
## Cache the Spatial RDD that is repeatedly used
diff --git a/docs/tutorial/flink/sql.md b/docs/tutorial/flink/sql.md
index c4fc334bf..ca98e9eb7 100644
--- a/docs/tutorial/flink/sql.md
+++ b/docs/tutorial/flink/sql.md
@@ -1,6 +1,7 @@
The page outlines the steps to manage spatial data using SedonaSQL. ==The
example code is written in Java but also works for Scala==.
SedonaSQL supports SQL/MM Part3 Spatial SQL Standard. It includes four kinds
of SQL operators as follows. All these operators can be directly called through:
+
```java
Table myTable = tableEnv.sqlQuery("YOUR_SQL")
```
@@ -17,6 +18,7 @@ Detailed SedonaSQL APIs are available here: [SedonaSQL
API](../../../api/flink/O
## Initiate Stream Environment
Use the following code to initiate your `StreamExecutionEnvironment` at the
beginning:
+
```java
StreamExecutionEnvironment env =
StreamExecutionEnvironment.getExecutionEnvironment();
EnvironmentSettings settings =
EnvironmentSettings.newInstance().inStreamingMode().build();
@@ -142,6 +144,7 @@ This `ST_Transform` transform the CRS of these geometries
from EPSG:4326 to EPSG
For example, a Table that has coordinates in the US will become like this.
Before the transformation:
+
```
+----+--------------------------------+--------------------------------+
| op | geom_point | name_point |
@@ -483,6 +486,7 @@ DataStream<Row> geomStream = text.map(new
MapFunction<String, Row>() {
### Get Spatial Table
Use TableEnv's fromDataStream function, with two column names `geom` and
`geom_name`.
+
```java
Table geomTable = sedona.fromDataStream(geomStream, "geom", "geom_name")
```
diff --git a/docs/tutorial/geopandas-shapely.md
b/docs/tutorial/geopandas-shapely.md
index bb41162aa..eec4cbe58 100644
--- a/docs/tutorial/geopandas-shapely.md
+++ b/docs/tutorial/geopandas-shapely.md
@@ -85,6 +85,7 @@ gdf.plot(
)
```
+
<br>
<br>
diff --git a/docs/tutorial/jupyter-notebook.md
b/docs/tutorial/jupyter-notebook.md
index 1c8ef50c1..24c4970de 100644
--- a/docs/tutorial/jupyter-notebook.md
+++ b/docs/tutorial/jupyter-notebook.md
@@ -10,24 +10,32 @@ Please use the following steps to run Jupyter notebook with
Pipenv on your machi
2. Install Sedona Python from PyPI or GitHub source: Read [Install Sedona
Python](../../setup/install-python/#install-sedona) to learn.
3. Prepare spark-shaded jar: Read [Install Sedona
Python](../../setup/install-python/#prepare-spark-shaded-jar) to learn.
4. Setup pipenv python version. Please use your desired Python version.
+
```bash
cd binder
pipenv --python 3.8
```
+
5. Install dependencies
+
```bash
cd binder
pipenv install
```
+
6. Install jupyter notebook kernel for pipenv
+
```bash
pipenv install ipykernel
pipenv shell
```
+
7. In the pipenv shell, do
+
```bash
python -m ipykernel install --user --name=apache-sedona
```
+
8. Setup environment variables `SPARK_HOME` and `PYTHONPATH` if you didn't do
it before. Read [Install Sedona
Python](../../setup/install-python/#setup-environment-variables) to learn.
9. Launch jupyter notebook: `jupyter notebook`
10. Select Sedona notebook. In your notebook, Kernel -> Change Kernel. Your
kernel should now be an option.
diff --git a/docs/tutorial/rdd.md b/docs/tutorial/rdd.md
index 2dceb4fd5..f0539f2fc 100644
--- a/docs/tutorial/rdd.md
+++ b/docs/tutorial/rdd.md
@@ -31,12 +31,14 @@ A generic SpatialRDD is not typed to a certain geometry
type and open to more sc
Geometries in a WKT and WKB file always occupy a single column no matter how
many coordinates they have. Sedona provides `WktReader ` and `WkbReader` to
create generic SpatialRDD.
Suppose we have a `checkin.tsv` WKT TSV file at Path `/Download/checkin.tsv`
as follows:
+
```
POINT (-88.331492 32.324142) hotel
POINT (-88.175933 32.360763) gas
POINT (-88.388954 32.357073) bar
POINT (-88.221102 32.35078) restaurant
```
+
This file has two columns and corresponding ==offsets==(Column IDs) are 0, 1.
Column 0 is the WKT string and Column 1 is the checkin business type.
Use the following code to create a SpatialRDD
@@ -176,11 +178,14 @@ To create a generic SpatialRDD from CSV, TSV, WKT, WKB
and GeoJSON input formats
We use checkin.csv CSV file as the example. You can create a generic
SpatialRDD using the following steps:
1. Load data in SedonaSQL.
+
```scala
var df = sedona.read.format("csv").option("header",
"false").load(csvPointInputLocation)
df.createOrReplaceTempView("inputtable")
```
+
2. Create a Geometry type column in SedonaSQL
+
```scala
var spatialDf = sedona.sql(
"""
@@ -188,7 +193,9 @@ var spatialDf = sedona.sql(
|FROM inputtable
""".stripMargin)
```
+
3. Use SedonaSQL DataFrame-RDD Adapter to convert a DataFrame to an SpatialRDD
+
```scala
var spatialRDD = Adapter.toSpatialRdd(spatialDf, "checkin")
```
diff --git a/docs/tutorial/snowflake/sql.md b/docs/tutorial/snowflake/sql.md
index 271c1e174..b0652bb61 100644
--- a/docs/tutorial/snowflake/sql.md
+++ b/docs/tutorial/snowflake/sql.md
@@ -21,6 +21,7 @@ FROM city_tbl;
```
Output:
+
```
WKT CITY_NAME
POINT (-122.33 47.61) Seattle
@@ -415,6 +416,7 @@ SELECT
ST_AsEWKT(SEDONA.ST_SetSRID(ST_GeometryFromWKT('POINT(1 2)'), 4326))
```
Output:
+
```
SRID=0;POINT(1 2)
```
diff --git a/docs/tutorial/sql.md b/docs/tutorial/sql.md
index 8c668de26..c3cb99d77 100644
--- a/docs/tutorial/sql.md
+++ b/docs/tutorial/sql.md
@@ -211,6 +211,7 @@ POLYGON (..., ...) Wahkiakum County
POLYGON (..., ...) De Baca County
POLYGON (..., ...) Lancaster County
```
+
The file may have many other columns.
Use the following code to load the data and create a raw DataFrame:
@@ -641,6 +642,7 @@ The dataset used here is the Chicago crimes dataset,
available [here](https://gi
SedonaPyDeck exposes a create_heatmap API which can be used to visualize a
heatmap out of the passed SedonaDataFrame containing points:
Example:
+
```python
SedonaPyDeck.create_heatmap(df=crimes_df)
```
diff --git a/docs/tutorial/zeppelin.md b/docs/tutorial/zeppelin.md
index c78d71501..f4e467c30 100644
--- a/docs/tutorial/zeppelin.md
+++ b/docs/tutorial/zeppelin.md
@@ -19,6 +19,7 @@ spark.sql(
```
Then create an SQL paragraph to fetch the data
+
```sql
%sql
SELECT *
@@ -47,6 +48,7 @@ spark.sql(
```
Then create an SQL paragraph to fetch the data
+
```sql
%sql
SELECT *, 'I am the map center!'