未验证 提交 4cf7515e 编写于 作者: sangshuduo's avatar sangshuduo 提交者: GitHub

docs: geometry supplemental docs (#22298)

* docs: geometry supplemental docs

* docs: minor correction

minor correction

---------
Co-authored-by: Ndanielclow <106956386+danielclow@users.noreply.github.com>
上级 c38fb684
......@@ -42,7 +42,7 @@ In TDengine, the data types below can be used when specifying a column or tag.
| 14 | NCHAR | User Defined | Multi-byte string that can include multi byte characters like Chinese characters. Each character of NCHAR type consumes 4 bytes storage. The string value should be quoted with single quotes. Literal single quote inside the string must be preceded with backslash, like `\'`. The length must be specified when defining a column or tag of NCHAR type, for example nchar(10) means it can store at most 10 characters of nchar type and will consume fixed storage of 40 bytes. An error will be reported if the string value exceeds the length defined. |
| 15 | JSON | | JSON type can only be used on tags. A tag of json type is excluded with any other tags of any other type. |
| 16 | VARCHAR | User-defined | Alias of BINARY |
| 16 | GEOMETRY | User-defined | Geometry |
| 17 | GEOMETRY | User-defined | Geometry |
:::note
- Each row of the table cannot be longer than 48KB (64KB since version 3.0.5.0) (note that each BINARY/NCHAR/GEOMETRY column takes up an additional 2 bytes of storage space).
......
......@@ -1274,3 +1274,161 @@ SELECT SERVER_STATUS();
```
**Description**: The server status.
## Geometry Functions
### Geometry Input Functions
Geometry input functions create geometry data from WTK.
#### ST_GeomFromText
```sql
ST_GeomFromText(VARCHAR WKT expr)
```
**Description**: Return a specified GEOMETRY value from Well-Known Text representation (WKT).
**Return value type**: GEOMETRY
**Applicable data types**: VARCHAR
**Applicable table types**: standard tables and supertables
**Explanations**:
- The input can be one of WTK string, like POINT, LINESTRING, POLYGON, MULTIPOINT, MULTILINESTRING, MULTIPOLYGON, GEOMETRYCOLLECTION.
- The output is a GEOMETRY data type, internal defined as binary string.
### Geometry Output Functions
Geometry output functions convert geometry data into WTK.
#### ST_AsText
```sql
ST_AsText(GEOMETRY geom)
```
**Description**: Return a specified Well-Known Text representation (WKT) value from GEOMETRY data.
**Return value type**: VARCHAR
**Applicable data types**: GEOMETRY
**Applicable table types**: standard tables and supertables
**Explanations**:
- The output can be one of WTK string, like POINT, LINESTRING, POLYGON, MULTIPOINT, MULTILINESTRING, MULTIPOLYGON, GEOMETRYCOLLECTION.
### Geometry Relationships Functions
Geometry relationships functions determine spatial relationships between geometries.
#### ST_Intersects
```sql
ST_Intersects(GEOMETRY geomA, GEOMETRY geomB)
```
**Description**: Compares two geometries and returns true if they intersect.
**Return value type**: BOOL
**Applicable data types**: GEOMETRY, GEOMETRY
**Applicable table types**: standard tables and supertables
**Explanations**:
- Geometries intersect if they have any point in common.
#### ST_Equals
```sql
ST_Equals(GEOMETRY geomA, GEOMETRY geomB)
```
**Description**: Returns TRUE if the given geometries are "spatially equal".
**Return value type**: BOOL
**Applicable data types**: GEOMETRY, GEOMETRY
**Applicable table types**: standard tables and supertables
**Explanations**:
- 'Spatially equal' means ST_Contains(A,B) = true and ST_Contains(B,A) = true, and the ordering of points can be different but represent the same geometry structure.
#### ST_Touches
```sql
ST_Touches(GEOMETRY geomA, GEOMETRY geomB)
```
**Description**: Returns TRUE if A and B intersect, but their interiors do not intersect.
**Return value type**: BOOL
**Applicable data types**: GEOMETRY, GEOMETRY
**Applicable table types**: standard tables and supertables
**Explanations**:
- A and B have at least one point in common, and the common points lie in at least one boundary.
- For Point/Point inputs the relationship is always FALSE, since points do not have a boundary.
#### ST_Covers
```sql
ST_Covers(GEOMETRY geomA, GEOMETRY geomB)
```
**Description**: Returns TRUE if every point in Geometry B lies inside (intersects the interior or boundary of) Geometry A.
**Return value type**: BOOL
**Applicable data types**: GEOMETRY, GEOMETRY
**Applicable table types**: standard tables and supertables
**Explanations**:
- A covers B means no point of B lies outside (in the exterior of) A.
#### ST_Contains
```sql
ST_Contains(GEOMETRY geomA, GEOMETRY geomB)
```
**Description**: Returns TRUE if geometry A contains geometry B.
**Return value type**: BOOL
**Applicable data types**: GEOMETRY, GEOMETRY
**Applicable table types**: standard tables and supertables
**Explanations**:
- A contains B if and only if all points of B lie inside (i.e. in the interior or boundary of) A (or equivalently, no points of B lie in the exterior of A), and the interiors of A and B have at least one point in common.
#### ST_ContainsProperly
```sql
ST_ContainsProperly(GEOMETRY geomA, GEOMETRY geomB)
```
**Description**: Returns TRUE if every point of B lies inside A.
**Return value type**: BOOL
**Applicable data types**: GEOMETRY, GEOMETRY
**Applicable table types**: standard tables and supertables
**Explanations**
- There is no point of B that lies on the boundary of A or in the exterior of A.
......@@ -1265,3 +1265,140 @@ SELECT SERVER_STATUS();
```
**说明**:检测服务端是否所有 dnode 都在线,如果是则返回成功,否则返回无法建立连接的错误。
## Geometry 函数
### Geometry 输入函数:
#### ST_GeomFromText
```sql
ST_GeomFromText(VARCHAR WKT expr)
```
**功能说明**:根据 Well-Known Text (WKT) 表示从指定的几何值创建几何数据。
**返回值类型**:GEOMETRY
**适用数据类型**:VARCHAR
**适用表类型**:标准表和超表
**使用说明**:输入可以是 WKT 字符串之一,例如点(POINT)、线串(LINESTRING)、多边形(POLYGON)、多点集(MULTIPOINT)、多线串(MULTILINESTRING)、多多边形(MULTIPOLYGON)、几何集合(GEOMETRYCOLLECTION)。输出是以二进制字符串形式定义的 GEOMETRY 数据类型。
### Geometry 输出函数:
#### ST_AsText
```sql
ST_AsText(GEOMETRY geom)
```
**功能说明**:从几何数据中返回指定的 Well-Known Text (WKT) 表示。
**返回值类型**:VARCHAR
**适用数据类型**:GEOMETRY
**适用表类型**:标准表和超表
**使用说明**:输出可以是 WKT 字符串之一,例如点(POINT)、线串(LINESTRING)、多边形(POLYGON)、多点集(MULTIPOINT)、多线串(MULTILINESTRING)、多多边形(MULTIPOLYGON)、几何集合(GEOMETRYCOLLECTION)。
### Geometry 关系函数:
#### ST_Intersects
```sql
ST_Intersects(GEOMETRY geomA, GEOMETRY geomB)
```
##功能说明**:比较两个几何对象,并在它们相交时返回 true。
**返回值类型**:BOOL
**适用数据类型**:GEOMETRY,GEOMETRY
**适用表类型**:标准表和超表
**使用说明**:如果两个几何对象有任何一个共享点,则它们相交。
#### ST_Equals
```sql
ST_Equals(GEOMETRY geomA, GEOMETRY geomB)
```
**功能说明**:如果给定的几何对象是"空间相等"的,则返回 TRUE。
**返回值类型**:BOOL
**适用数据类型**:GEOMETRY,GEOMETRY
**适用表类型**:标准表和超表
**使用说明**:"空间相等"意味着 ST_Contains(A,B) = true 和 ST_Contains(B,A) = true,并且点的顺序可能不同,但表示相同的几何结构。
#### ST_Touches
```sql
ST_Touches(GEOMETRY geomA, GEOMETRY geomB)
```
**功能说明**:如果 A 和 B 相交,但它们的内部不相交,则返回 TRUE。
**返回值类型**:BOOL
**适用数据类型**:GEOMETRY,GEOMETRY
**适用表类型**:标准表和超表
**使用说明**:A 和 B 至少有一个公共点,并且这些公共点位于至少一个边界中。对于点/点输入,关系始终为 FALSE,因为点没有边界。
#### ST_Covers
```sql
ST_Covers(GEOMETRY geomA, GEOMETRY geomB)
```
**功能说明**:如果 B 中的每个点都位于几何形状 A 内部(与内部或边界相交),则返回 TRUE。
**返回值类型**:BOOL
**适用数据类型**:GEOMETRY,GEOMETRY
**适用表类型**:标准表和超表
**使用说明**:A 包含 B 意味着 B 中的没有点位于 A 的外部(在外部)。
#### ST_Contains
```sql
ST_Contains(GEOMETRY geomA, GEOMETRY geomB)
```
**功能说明**:如果 A 包含 B,描述:如果几何形状 A 包含几何形状 B,则返回 TRUE。
**返回值类型**:BOOL
**适用数据类型**:GEOMETRY,GEOMETRY
**适用表类型**:标准表和超表
**使用说明**:A 包含 B 当且仅当 B 的所有点位于 A 的内部(即位于内部或边界上)(或等效地,B 的没有点位于 A 的外部),并且 A 和 B 的内部至少有一个公共点。
#### ST_ContainsProperly
```sql
ST_ContainsProperly(GEOMETRY geomA, GEOMETRY geomB)
```
**功能说明**:如果 B 的每个点都位于 A 内部,则返回 TRUE。
**返回值类型**:BOOL
**适用数据类型**:GEOMETRY,GEOMETRY
**适用表类型**:标准表和超表
**使用说明**:B 的没有点位于 A 的边界或外部。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册