Create simple geometries from ordered rows of GeoPoints(从有序的GeoPoint行创建简单几何图形)¶
Supported in: Batch
Given a column of GeoPoints and an ordering, return either a polygon or a line string by connecting the GeoPoints in the specified order. This function assumes that the data is tabular, with a single row representing an individual GeoPoint in a line string or in the shell of a polygon, along with a column specifying the order of those points. For a polygon this ordering should identify the points as you move counter-clockwise around the shell. Given an ordering of these points and a partition (grouping), the function constructs the required geometry for that partition by joining the GeoPoints in ascending order of the order-by column.
Expression categories: Geospatial
Declared arguments¶
- GeoPoint: A column of GeoPoints from which the geometry is constructed. Each row in the dataset should represent an individual GeoPoint. If there are null values, these rows are ignored.
Expression\ - Order by (ascending): A column of values by which the GeoPoints will be ordered to construct the line string or the shell of the desired polygon. The ordering is random if values are identical within a group. If there are null values, those rows are ignored.
Expression\ - Output geometry type: Whether the output should be a polygon or a line-string.
Enum\
Output type: Geometry
Examples¶
Example 1: Base case¶
Argument values:
- GeoPoint:
geo_point - Order by (ascending):
order - Output geometry type:
LINE_STRING
Given input table:
| geo_point | order |
|---|---|
| { latitude -> 0.0, longitude -> 0.0, } |
0 |
| { latitude -> 1.0, longitude -> 0.0, } |
1 |
| { latitude -> 1.0, longitude -> 1.0, } |
2 |
Outputs: {"type":"LineString","coordinates": [[0.0,0.0],[0.0, 1.0],[1.0,1.0]]}
Example 2: Base case¶
Argument values:
- GeoPoint:
geo_point - Order by (ascending):
order - Output geometry type:
POLYGON
Given input table:
| geo_point | order |
|---|---|
| { latitude -> 0.0, longitude -> 0.0, } |
0 |
| { latitude -> 1.0, longitude -> 0.0, } |
3 |
| { latitude -> 1.0, longitude -> 1.0, } |
2 |
| { latitude -> 0.0, longitude -> 0.0, } |
4 |
| { latitude -> 0.0, longitude -> 1.0, } |
1 |
Outputs: {"type":"Polygon","coordinates": [[[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0], [0.0, 0.0]]]}
Example 3: Base case¶
Argument values:
- GeoPoint:
geo_point - Order by (ascending):
order - Output geometry type:
LINE_STRING
Given input table:
| geo_point | order |
|---|---|
| { latitude -> 0.0, longitude -> 0.0, } |
0.0 |
| null | 1.0 |
| null | 2.0 |
| { latitude -> 0.0, longitude -> 1.0, } |
2.0 |
Outputs: {"type":"LineString","coordinates": [[0.0,0.0],[1.0, 0.0]]}
Example 4: Base case¶
Argument values:
- GeoPoint:
geo_point - Order by (ascending):
order - Output geometry type:
LINE_STRING
Given input table:
| geo_point | order |
|---|---|
| { latitude -> 0.0, longitude -> 0.0, } |
0.0 |
Outputs: null
Example 5: Base case¶
Argument values:
- GeoPoint:
geo_point - Order by (ascending):
order - Output geometry type:
POLYGON
Given input table:
| geo_point | order |
|---|---|
| { latitude -> 0.0, longitude -> 0.0, } |
0 |
| { latitude -> 1.0, longitude -> 1.0, } |
2 |
| { latitude -> 1.0, longitude -> 0.0, } |
3 |
| { latitude -> 0.0, longitude -> 1.0, } |
1 |
Outputs: {"type":"Polygon","coordinates": [[[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0], [0.0, 0.0]]]}
Example 6: Base case¶
Argument values:
- GeoPoint:
geo_point - Order by (ascending):
order - Output geometry type:
POLYGON
Given input table:
| geo_point | order |
|---|---|
| { latitude -> 0.0, longitude -> 0.0, } |
0 |
| { latitude -> 1.0, longitude -> 0.0, } |
1 |
Outputs: null
Example 7: Null case¶
Argument values:
- GeoPoint:
geo_point - Order by (ascending):
order - Output geometry type:
POLYGON
Given input table:
| geo_point | order |
|---|---|
| null | 0 |
Outputs: null
Example 8: Null case¶
Argument values:
- GeoPoint:
geo_point - Order by (ascending):
order - Output geometry type:
LINE_STRING
Given input table:
| geo_point | order |
|---|---|
| { latitude -> 0.0, longitude -> 0.0, } |
0 |
| { latitude -> 1.0, longitude -> 1.0, } |
null |
| { latitude -> 1.0, longitude -> 0.0, } |
1 |
Outputs: {"type":"LineString","coordinates": [[0.0,0.0],[0.0, 1.0]]}
中文翻译¶
从有序的GeoPoint行创建简单几何图形¶
支持:批处理模式
给定一个GeoPoint列和一个排序依据,通过按指定顺序连接GeoPoints,返回多边形或线串。此函数假设数据为表格形式,每一行代表线串或多边形外壳中的一个独立GeoPoint,同时包含一个指定这些点顺序的列。对于多边形,此顺序应标识沿外壳逆时针移动的点。给定这些点的顺序和分区(分组),该函数通过按排序依据列的升序连接GeoPoints,为该分区构建所需的几何图形。
表达式类别: 地理空间
声明的参数¶
- GeoPoint: 用于构建几何图形的GeoPoint列。数据集中的每一行应代表一个独立的GeoPoint。如果存在空值,则忽略这些行。
表达式\ - 排序依据(升序): 用于对GeoPoints进行排序以构建线串或所需多边形外壳的值的列。如果组内值相同,则排序是随机的。如果存在空值,则忽略这些行。
表达式\ - 输出几何类型: 输出应为多边形还是线串。
枚举\
输出类型: Geometry
示例¶
示例1:基本情况¶
参数值:
- GeoPoint:
geo_point - 排序依据(升序):
order - 输出几何类型:
LINE_STRING
给定输入表:
| geo_point | order |
|---|---|
| { latitude -> 0.0, longitude -> 0.0, } |
0 |
| { latitude -> 1.0, longitude -> 0.0, } |
1 |
| { latitude -> 1.0, longitude -> 1.0, } |
2 |
输出: {"type":"LineString","coordinates": [[0.0,0.0],[0.0, 1.0],[1.0,1.0]]}
示例2:基本情况¶
参数值:
- GeoPoint:
geo_point - 排序依据(升序):
order - 输出几何类型:
POLYGON
给定输入表:
| geo_point | order |
|---|---|
| { latitude -> 0.0, longitude -> 0.0, } |
0 |
| { latitude -> 1.0, longitude -> 0.0, } |
3 |
| { latitude -> 1.0, longitude -> 1.0, } |
2 |
| { latitude -> 0.0, longitude -> 0.0, } |
4 |
| { latitude -> 0.0, longitude -> 1.0, } |
1 |
输出: {"type":"Polygon","coordinates": [[[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0], [0.0, 0.0]]]}
示例3:基本情况¶
参数值:
- GeoPoint:
geo_point - 排序依据(升序):
order - 输出几何类型:
LINE_STRING
给定输入表:
| geo_point | order |
|---|---|
| { latitude -> 0.0, longitude -> 0.0, } |
0.0 |
| null | 1.0 |
| null | 2.0 |
| { latitude -> 0.0, longitude -> 1.0, } |
2.0 |
输出: {"type":"LineString","coordinates": [[0.0,0.0],[1.0, 0.0]]}
示例4:基本情况¶
参数值:
- GeoPoint:
geo_point - 排序依据(升序):
order - 输出几何类型:
LINE_STRING
给定输入表:
| geo_point | order |
|---|---|
| { latitude -> 0.0, longitude -> 0.0, } |
0.0 |
输出: null
示例5:基本情况¶
参数值:
- GeoPoint:
geo_point - 排序依据(升序):
order - 输出几何类型:
POLYGON
给定输入表:
| geo_point | order |
|---|---|
| { latitude -> 0.0, longitude -> 0.0, } |
0 |
| { latitude -> 1.0, longitude -> 1.0, } |
2 |
| { latitude -> 1.0, longitude -> 0.0, } |
3 |
| { latitude -> 0.0, longitude -> 1.0, } |
1 |
输出: {"type":"Polygon","coordinates": [[[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0], [0.0, 0.0]]]}
示例6:基本情况¶
参数值:
- GeoPoint:
geo_point - 排序依据(升序):
order - 输出几何类型:
POLYGON
给定输入表:
| geo_point | order |
|---|---|
| { latitude -> 0.0, longitude -> 0.0, } |
0 |
| { latitude -> 1.0, longitude -> 0.0, } |
1 |
输出: null
示例7:空值情况¶
参数值:
- GeoPoint:
geo_point - 排序依据(升序):
order - 输出几何类型:
POLYGON
给定输入表:
| geo_point | order |
|---|---|
| null | 0 |
输出: null
示例8:空值情况¶
参数值:
- GeoPoint:
geo_point - 排序依据(升序):
order - 输出几何类型:
LINE_STRING
给定输入表:
| geo_point | order |
|---|---|
| { latitude -> 0.0, longitude -> 0.0, } |
0 |
| { latitude -> 1.0, longitude -> 1.0, } |
null |
| { latitude -> 1.0, longitude -> 0.0, } |
1 |
输出: {"type":"LineString","coordinates": [[0.0,0.0],[0.0, 1.0]]}