Skip to content

Commit

Permalink
[DOCS] Add example outputs to all Sedona functions - 8 (#925)
Browse files Browse the repository at this point in the history
  • Loading branch information
furqaankhan committed Jul 27, 2023
1 parent 18d28dc commit e43ed84
Show file tree
Hide file tree
Showing 2 changed files with 188 additions and 64 deletions.
127 changes: 95 additions & 32 deletions docs/api/flink/Predicate.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@ Format: `ST_Contains (A:geometry, B:geometry)`
Since: `v1.2.0`

SQL example:

```sql
SELECT *
FROM pointdf
WHERE ST_Contains(ST_PolygonFromEnvelope(1.0,100.0,1000.0,1100.0), pointdf.arealandmark)
SELECT ST_Contains(ST_GeomFromWKT('POLYGON((175 150,20 40,50 60,125 100,175 150))'), ST_GeomFromWKT('POINT(174 149)'))
```

Output:

```
false
```

## ST_Crosses
Expand All @@ -22,10 +27,15 @@ Format: `ST_Crosses (A:geometry, B:geometry)`
Since: `v1.5.0`

SQL example:

```sql
SELECT *
FROM pointdf
WHERE ST_Crosses(pointdf.arealandmark, ST_PolygonFromEnvelope(1.0,100.0,1000.0,1100.0))
SELECT ST_Crosses(ST_GeomFromWKT('POLYGON((1 1, 4 1, 4 4, 1 4, 1 1))'),ST_GeomFromWKT('POLYGON((2 2, 5 2, 5 5, 2 5, 2 2))'))
```

Output:

```
false
```

## ST_Disjoint
Expand All @@ -37,10 +47,15 @@ Format: `ST_Disjoint (A:geometry, B:geometry)`
Since: `v1.2.1`

SQL example:

```sql
SELECT *
FROM pointdf
WHERE ST_Disjoinnt(ST_PolygonFromEnvelope(1.0,100.0,1000.0,1100.0), pointdf.arealandmark)
SELECT ST_Disjoint(ST_GeomFromWKT('POLYGON((1 4, 4.5 4, 4.5 2, 1 2, 1 4))'),ST_GeomFromWKT('POLYGON((5 4, 6 4, 6 2, 5 2, 5 4))'))
```

Output:

```
true
```

## ST_Equals
Expand All @@ -52,10 +67,15 @@ Format: `ST_Equals (A:geometry, B:geometry)`
Since: `v1.5.0`

SQL example:

```sql
SELECT *
FROM pointdf
WHERE ST_Equals(pointdf.arealandmark, ST_PolygonFromEnvelope(1.0,100.0,1000.0,1100.0))
SELECT ST_Equals(ST_GeomFromWKT('LINESTRING(0 0,10 10)'), ST_GeomFromWKT('LINESTRING(0 0,5 5,10 10)'))
```

Output:

```
true
```

## ST_Intersects
Expand All @@ -67,12 +87,18 @@ Format: `ST_Intersects (A:geometry, B:geometry)`
Since: `v1.2.0`

SQL example:

```sql
SELECT *
FROM pointdf
WHERE ST_Intersects(ST_PolygonFromEnvelope(1.0,100.0,1000.0,1100.0), pointdf.arealandmark)
SELECT ST_Intersects(ST_GeomFromWKT('LINESTRING(-43.23456 72.4567,-43.23456 72.4568)'), ST_GeomFromWKT('POINT(-43.23456 72.4567772)'))
```

Output:

```
true
```


## ST_Overlaps

Introduction: Return true if A overlaps B
Expand All @@ -82,12 +108,18 @@ Format: `ST_Overlaps (A:geometry, B:geometry)`
Since: `v1.5.0`

SQL example:

```sql
SELECT *
FROM geom
WHERE ST_Overlaps(geom.geom_a, geom.geom_b)
SELECT ST_Overlaps(ST_GeomFromWKT('POLYGON((2.5 2.5, 2.5 4.5, 4.5 4.5, 4.5 2.5, 2.5 2.5))'), ST_GeomFromWKT('POLYGON((4 4, 4 6, 6 6, 6 4, 4 4))'))
```

Output:

```
true
```


## ST_Touches

Introduction: Return true if A touches B
Expand All @@ -97,10 +129,15 @@ Format: `ST_Touches (A:geometry, B:geometry)`
Since: `v1.5.0`

SQL example:

```sql
SELECT *
FROM pointdf
WHERE ST_Touches(pointdf.arealandmark, ST_PolygonFromEnvelope(1.0,100.0,1000.0,1100.0))
SELECT ST_Touches(ST_GeomFromWKT('LINESTRING(0 0,1 1,0 2)'), ST_GeomFromWKT('POINT(0 2)'))
```

Output:

```
true
```

## ST_Within
Expand All @@ -112,10 +149,15 @@ Format: `ST_Within (A:geometry, B:geometry)`
Since: `v1.3.0`

SQL example:

```sql
SELECT *
FROM pointdf
WHERE ST_Within(pointdf.arealandmark, ST_PolygonFromEnvelope(1.0,100.0,1000.0,1100.0))
SELECT ST_Within(ST_GeomFromWKT('POLYGON((0 0,3 0,3 3,0 3,0 0))'), ST_GeomFromWKT('POLYGON((1 1,2 1,2 2,1 2,1 1))'))
```

Output:

```
false
```

## ST_OrderingEquals
Expand All @@ -126,18 +168,28 @@ Format: `ST_OrderingEquals(A: geometry, B: geometry)`
Since: `v1.2.1`

SQL example 1:

```sql
SELECT ST_OrderingEquals(ST_GeomFromWKT('POLYGON((2 0, 0 2, -2 0, 2 0))'), ST_GeomFromWKT('POLYGON((2 0, 0 2, -2 0, 2 0))'))
```

Output: `true`
Output:

```
true
```

SQL example 2:

```sql
SELECT ST_OrderingEquals(ST_GeomFromWKT('POLYGON((2 0, 0 2, -2 0, 2 0))'), ST_GeomFromWKT('POLYGON((0 2, -2 0, 2 0, 0 2))'))
```

Output: `false`
Output:

```
false
```

## ST_Covers

Expand All @@ -148,12 +200,18 @@ Format: `ST_Covers (A:geometry, B:geometry)`
Since: `v1.3.0`

SQL example:

```sql
SELECT *
FROM pointdf
WHERE ST_Covers(ST_PolygonFromEnvelope(1.0,100.0,1000.0,1100.0), pointdf.arealandmark)
SELECT ST_Covers(ST_GeomFromWKT('POLYGON((-2 0,0 2,2 0,-2 0))'), ST_GeomFromWKT('POLYGON((-1 0,0 1,1 0,-1 0))'))
```

Output:

```
true
```


## ST_CoveredBy

Introduction: Return true if A is covered by B
Expand All @@ -163,8 +221,13 @@ Format: `ST_CoveredBy (A:geometry, B:geometry)`
Since: `v1.3.0`

SQL example:

```sql
SELECT *
FROM pointdf
WHERE ST_CoveredBy(pointdf.arealandmark, ST_PolygonFromEnvelope(1.0,100.0,1000.0,1100.0))
SELECT ST_CoveredBy(ST_GeomFromWKT('POLYGON((0 0,3 0,3 3,0 3,0 0))'), ST_GeomFromWKT('POLYGON((1 1,2 1,2 2,1 2,1 1))'))
```

Output:

```
false
```
Loading

0 comments on commit e43ed84

Please sign in to comment.