Skip to content

Commit

Permalink
[DOCS] Add example outputs to all Sedona functions - 4 (#920)
Browse files Browse the repository at this point in the history
  • Loading branch information
furqaankhan committed Jul 25, 2023
1 parent a8c8ea7 commit 81f62d6
Show file tree
Hide file tree
Showing 2 changed files with 160 additions and 57 deletions.
106 changes: 80 additions & 26 deletions docs/api/flink/Function.md
Original file line number Diff line number Diff line change
Expand Up @@ -1195,11 +1195,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 @@ -1212,8 +1217,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 @@ -1230,6 +1243,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 @@ -1248,15 +1267,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 @@ -1266,11 +1293,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 @@ -1287,7 +1319,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 @@ -1300,8 +1336,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 @@ -1315,8 +1356,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 @@ -1330,8 +1376,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 @@ -1345,11 +1396,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 @@ -1362,13 +1418,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 @@ -1379,17 +1436,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

0 comments on commit 81f62d6

Please sign in to comment.