Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOCS] Add example outputs to all Sedona functions - 4 #920

Merged
merged 13 commits into from
Jul 25, 2023
106 changes: 80 additions & 26 deletions docs/api/flink/Function.md
Original file line number Diff line number Diff line change
Expand Up @@ -1111,11 +1111,16 @@ Format: `ST_InteriorRingN(geom: geometry, n: Int)`
Since: `v1.3.0`

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)
```

Output: `LINEARRING (1 1, 2 1, 2 2, 1 2, 1 1)`
Output:

```
LINEARRING (1 1, 2 1, 2 2, 1 2, 1 1)
```

## ST_Intersection

Expand All @@ -1128,8 +1133,16 @@ Since: `v1.5.0`
Example:

```sql
SELECT ST_Intersection(polygondf.countyshape, polygondf.countyshape)
FROM polygondf
SELECT ST_Intersection(
ST_GeomFromWKT("POLYGON((1 1, 8 1, 8 8, 1 8, 1 1))"),
ST_GeomFromWKT("POLYGON((2 2, 9 2, 9 9, 2 9, 2 2))")
)
```

Output:

```
POLYGON ((2 8, 8 8, 8 2, 2 2, 2 8))
```

## ST_IsClosed
Expand All @@ -1146,6 +1159,12 @@ Example:
SELECT ST_IsClosed(ST_GeomFromText('LINESTRING(0 0, 1 1, 1 0)'))
```

Output:

```
false
```

## ST_IsCollection

Introduction: Returns `TRUE` if the geometry type of the input is a geometry collection type.
Expand All @@ -1164,15 +1183,23 @@ Example:
SELECT ST_IsCollection(ST_GeomFromText('MULTIPOINT(0 0), (6 6)'))
```

Output: `true`
Output:

```
true
```

Example:

```sql
SELECT ST_IsCollection(ST_GeomFromText('POINT(5 5)'))
```

Output: `false`
Output:

```
false
```

## ST_IsEmpty

Expand All @@ -1182,11 +1209,16 @@ Format: `ST_IsEmpty (A:geometry)`

Since: `v1.2.1`

Spark SQL example:
Example:

```sql
SELECT ST_IsEmpty(polygondf.countyshape)
FROM polygondf
SELECT ST_IsEmpty(ST_GeomFromWKT('POLYGON((0 0,0 1,1 1,1 0,0 0))'))
```

Output:

```
false
```

## ST_IsRing
Expand All @@ -1203,7 +1235,11 @@ Example:
SELECT ST_IsRing(ST_GeomFromText("LINESTRING(0 0, 0 1, 1 1, 1 0, 0 0)"))
```

Output: `true`
Output:

```
true
```

## ST_IsSimple

Expand All @@ -1216,8 +1252,13 @@ Since: `v1.3.0`
Example:

```sql
SELECT ST_IsSimple(polygondf.countyshape)
FROM polygondf
SELECT ST_IsSimple(ST_GeomFromWKT('POLYGON((1 1, 3 1, 3 3, 1 3, 1 1))'))
```

Output:

```
true
```

## ST_IsValid
Expand All @@ -1231,8 +1272,13 @@ Since: `v1.3.0`
Example:

```sql
SELECT ST_IsValid(polygondf.countyshape)
FROM polygondf
SELECT ST_IsValid(ST_GeomFromWKT('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0), (15 15, 15 20, 20 20, 20 15, 15 15))'))
```

Output:

```
false
```

## ST_Length
Expand All @@ -1246,8 +1292,13 @@ Since: `v1.3.0`
Example:

```sql
SELECT ST_Length(polygondf.countyshape)
FROM polygondf
SELECT ST_Length(ST_GeomFromWKT('LINESTRING(38 16,38 50,65 50,66 16,38 16)'))
```

Output:

```
123.0147027033899
```

## ST_LengthSpheroid
Expand All @@ -1261,11 +1312,16 @@ Format: `ST_LengthSpheroid (A:geometry)`
Since: `v1.4.1`

Example:

```sql
SELECT ST_LengthSpheroid(ST_GeomFromWKT('Polygon ((0 0, 0 90, 0 0))'))
```

Output: `20037508.342789244`
Output:

```
20037508.342789244
```

## ST_LineFromMultiPoint

Expand All @@ -1278,13 +1334,14 @@ Since: `v1.3.0`
Example:

```sql
SELECT ST_LineFromMultiPoint(df.geometry) AS geom
FROM df
SELECT ST_LineFromMultiPoint(ST_GeomFromText('MULTIPOINT((10 40), (40 30), (20 20), (30 10))'))
```

Input: `MULTIPOINT((10 40), (40 30), (20 20), (30 10))`
Output:

Output: `LINESTRING (10 40, 40 30, 20 20, 30 10)`
```
LINESTRING (10 40, 40 30, 20 20, 30 10)
```

## ST_LineInterpolatePoint

Expand All @@ -1295,17 +1352,14 @@ Format: `ST_LineInterpolatePoint (geom: geometry, fraction: Double)`
Since: `v1.5.0`

Example:

```sql
SELECT ST_LineInterpolatePoint(ST_GeomFromWKT('LINESTRING(25 50, 100 125, 150 190)'), 0.2) as Interpolated
SELECT ST_LineInterpolatePoint(ST_GeomFromWKT('LINESTRING(25 50, 100 125, 150 190)'), 0.2)
```

Output:
```
+-----------------------------------------+
|Interpolated |
+-----------------------------------------+
|POINT (51.5974135047432 76.5974135047432)|
+-----------------------------------------+
POINT (51.5974135047432 76.5974135047432)
```

## ST_LineMerge
Expand Down
Loading