mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-30 11:32:03 +00:00
Docs - S2 Cap,Union,Contains,Intersect functions
This commit is contained in:
parent
21ba2c6596
commit
5bbf761a68
@ -94,7 +94,7 @@ s2ToGeo(s2index)
|
||||
|
||||
**Arguments**
|
||||
|
||||
- `s2Index` — S2 Index. [UInt64](../../../sql-reference/data-types/int-uint.md).
|
||||
- `s2index` — S2 Index. [UInt64](../../../sql-reference/data-types/int-uint.md).
|
||||
|
||||
**Returned values**
|
||||
|
||||
@ -118,3 +118,122 @@ Result:
|
||||
│ [5074766987100422144,5074766712222515200,5074767536856236032,5074767261978329088] │
|
||||
└───────────────────────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
## s2CellsIntersect {#s2CellsIntersect}
|
||||
|
||||
Determines if the two provided [S2](#s2index)) cell indices intersect or not.
|
||||
|
||||
**Syntax**
|
||||
|
||||
``` sql
|
||||
s2CellsIntersect(s2index1, s2index2)
|
||||
```
|
||||
|
||||
**Arguments**
|
||||
|
||||
- `siIndex1`, `s2index2` — S2 Index. [UInt64](../../../sql-reference/data-types/int-uint.md).
|
||||
|
||||
**Returned values**
|
||||
|
||||
- 1 — If the S2 cell indices intersect.
|
||||
- 0 — If the S2 cell indices don't intersect.
|
||||
|
||||
Type: [UInt8](../../../sql-reference/data-types/int-uint.md).
|
||||
|
||||
**Example**
|
||||
|
||||
Query:
|
||||
|
||||
``` sql
|
||||
select s2CellsIntersect(9926595209846587392, 9926594385212866560) as intersect;
|
||||
```
|
||||
|
||||
Result:
|
||||
|
||||
``` text
|
||||
┌─intersect─┐
|
||||
│ 1 │
|
||||
└───────────┘
|
||||
```
|
||||
|
||||
|
||||
## s2CapContains {#s2CapContains}
|
||||
|
||||
A cap represents a portion of the sphere that has been cut off by a plane. It is defined by a point on a sphere and a radius in degrees. Imagine that we draw a line through the center of the sphere and our point. An infinite number of planes pass through this line, but any plane will intersect the cap in two points. Thus the angle is defined by one of this points and the entire line. So, the radius of Pi/2 defines a hemisphere and the radius of Pi defines a whole sphere.
|
||||
|
||||
Determines if a cap contains a s2 point index.
|
||||
|
||||
**Syntax**
|
||||
|
||||
``` sql
|
||||
s2CellsIntersect(center, degrees, point)
|
||||
```
|
||||
|
||||
**Arguments**
|
||||
|
||||
- `center` - S2 point index corresponding to the cap. [UInt64](../../../sql-reference/data-types/int-uint.md).
|
||||
- `degrees` - Radius of the cap in degrees. [Float64](../../../sql-reference/data-types/float.md).
|
||||
- `point` - S2 point index. [UInt64](../../../sql-reference/data-types/int-uint.md).
|
||||
|
||||
**Returned values**
|
||||
|
||||
- 1 — If the cap contains the S2 point index.
|
||||
- 0 — If the cap doesn't contain the S2 point index.
|
||||
|
||||
Type: [UInt8](../../../sql-reference/data-types/int-uint.md).
|
||||
|
||||
**Example**
|
||||
|
||||
Query:
|
||||
|
||||
``` sql
|
||||
select s2CapContains(1157339245694594829, 1.0, 1157347770437378819) as capContains;
|
||||
```
|
||||
|
||||
Result:
|
||||
|
||||
``` text
|
||||
┌─capContains─┐
|
||||
│ 1 │
|
||||
└─────────────┘
|
||||
```
|
||||
|
||||
|
||||
## s2CapUnion {#s2CapUnion}
|
||||
|
||||
A cap represents a portion of the sphere that has been cut off by a plane. It is defined by a point on a sphere and a radius in degrees. Imagine that we draw a line through the center of the sphere and our point. An infinite number of planes pass through this line, but any plane will intersect the cap in two points. Thus the angle is defined by one of this points and the entire line. So, the radius of Pi/2 defines a hemisphere and the radius of Pi defines a whole sphere.
|
||||
|
||||
Determines the smallest cap that contains the given two input caps.
|
||||
|
||||
**Syntax**
|
||||
|
||||
``` sql
|
||||
s2CapUnion(center1, radius1, center2, radius2)
|
||||
```
|
||||
|
||||
**Arguments**
|
||||
|
||||
- `center1`, `center2` - S2 point indices corresponding to the two input caps. [UInt64](../../../sql-reference/data-types/int-uint.md).
|
||||
- `radius1`, `radius2` - Radii of the two input caps in degrees. [Float64](../../../sql-reference/data-types/float.md).
|
||||
|
||||
**Returned values**
|
||||
|
||||
- `center` - S2 point index corresponding the center of the smallest cap containing the two input caps. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
|
||||
- `radius` - Radius of the smallest cap containing the two input caps. Type: [Float64](../../../sql-reference/data-types/float.md).
|
||||
|
||||
|
||||
**Example**
|
||||
|
||||
Query:
|
||||
|
||||
``` sql
|
||||
SELECT s2CapUnion(3814912406305146967, 1.0, 1157347770437378819, 1.0) AS capUnion;
|
||||
```
|
||||
|
||||
Result:
|
||||
|
||||
``` text
|
||||
┌─capUnion───────────────────────────────┐
|
||||
│ (4534655147792050737,60.2088283994957) │
|
||||
└────────────────────────────────────────┘
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user