Nth chain in polygon(多边形中的第N环 (Nth chain in polygon))¶
Supported in: Batch, Faster, Streaming
Returns the nth ring in a single polygon in the geometry. Indexing is 1-based, and an index of 0 is out-of-bounds. An index equal to 1 returns an external ring. An index greater than 1 returns an internal ring. Returns null for any of the following conditions: geometry isn't a single polygon, a feature collection or geometry collection is provided, index is out-of-bounds, or at least one argument is null.
Expression categories: Geospatial
Declared arguments¶
- N: Index of the ring to retrieve. Indexing is 1-based, and an index of 0 is out-of-bounds. An index greater than 1 returns an internal ring.
Expression\ - Polygon: Polygon to retrieve the nth ring of.
Expression\
Output type: Geometry
Examples¶
Example 1: Base case¶
Argument values:
- N:
n - Polygon:
polygon
| polygon | n | Output |
|---|---|---|
| {"type":"Polygon","coordinates":[[[0.0,0.0],[0.0,10.0],[10.0,10.0],[10.0,0.0],[0.0,0.0]]]} | 1 | {"coordinates": [[0.0, 0.0], [0.0, 10.0], [10.0, 10.0], [10.0, 0.0], [0.0, 0.0]], "type": "LineString"} |
| {"type":"Polygon","coordinates":[[[0.0,0.0],[0.0,10.0],[10.0,10.0],[10.0,0.0],[0.0,0.0]]]} | 2 | null |
| {"coordinates":[[[60.0,60.0],[50.0,60.0],[50.0,50.0],[60.0,50.0],[60.0,60.0]],[[57.0,57.0],[55.0,52.0],[52.0,52.0],[50.0,57.0],[57.0,57.0]]],"type":"Polygon"} | 1 | {"coordinates": [[60.0,60.0],[50.0,60.0],[50.0,50.0],[60.0,50.0],[60.0,60.0]], "type": "LineString"} |
| {"coordinates":[[[60.0,60.0],[50.0,60.0],[50.0,50.0],[60.0,50.0],[60.0,60.0]],[[57.0,57.0],[55.0,52.0],[52.0,52.0],[50.0,57.0],[57.0,57.0]]],"type":"Polygon"} | 2 | {"coordinates": [[57.0,57.0],[55.0,52.0],[52.0,52.0],[50.0,57.0],[57.0,57.0]], "type": "LineString"} |
Example 2: Null case¶
Argument values:
- N:
n - Polygon:
polygon
| polygon | n | Output |
|---|---|---|
| {"coordinates": [[[[2.0, 2.0], [7.0, 2.0], [7.0, 7.0], [2.0, 7.0], [2.0, 2.0]]], [[[12.0, 12.0], [17.0, 12.0], [17.0, 17.0], [12.0, 17.0], [12.0, 12.0]]]], "type":"MultiPolygon"} | 1 | null |
| {"type":"Polygon","coordinates":[[[0.0,0.0],[0.0,10.0],[10.0,10.0],[10.0,0.0],[0.0,0.0]]]} | null | null |
| {"type":"Polygon","coordinates":[[[0.0,0.0],[0.0,10.0],[10.0,10.0],[10.0,0.0],[0.0,0.0]]]} | 0 | null |
| null | 1 | null |
| null | null | null |
Example 3: Edge case¶
Argument values:
- N:
n - Polygon:
polygon
| polygon | n | Output |
|---|---|---|
| {"coordinates":[[[60.0,60.0],[50.0,60.0],[50.0,50.0],[60.0,50.0],[60.0,60.0]],[[57.0,57.0],[55.0,52.... | 1 | {"coordinates": [[60.0,60.0],[50.0,60.0],[50.0,50.0],[60.0,50.0],[60.0,60.0]], "type": "LineString"} |
| {"coordinates":[[[60.0,60.0],[50.0,60.0],[50.0,50.0],[60.0,50.0],[60.0,60.0]],[[57.0,57.0],[55.0,52.... | 2 | {"coordinates": [[57.0,57.0],[55.0,52.0],[52.0,52.0],[50.0,57.0],[57.0,57.0]], "type": "LineString"} |
| {"coordinates":[[[60.0,60.0],[50.0,60.0],[50.0,50.0],[60.0,50.0],[60.0,60.0]],[[57.0,57.0],[55.0,52.... | 3 | {"coordinates": [[58.0,58.0],[58.0,59.0],[59.0,59.0],[59.0,58.0],[58.0,58.0]], "type": "LineString"} |
| {"coordinates":[[[60.0,60.0],[50.0,60.0],[50.0,50.0],[60.0,50.0],[60.0,60.0]],[[57.0,57.0],[55.0,52.... | 4 | {"coordinates": [[52.0,58.5],[56.0,58.5],[54.0,57.5],[52.0,58.5]], "type": "LineString"} |
| {"coordinates":[[[60.0,60.0],[50.0,60.0],[50.0,50.0],[60.0,50.0],[60.0,60.0]],[[57.0,57.0],[55.0,52.... | 5 | null |
中文翻译¶
多边形中的第N环 (Nth chain in polygon)¶
支持:批处理 (Batch)、快速处理 (Faster)、流处理 (Streaming)
返回几何体中单个多边形的第N个环。索引从1开始,索引0超出范围。索引等于1返回外环,索引大于1返回内环。在以下任一情况下返回null:几何体不是单个多边形、提供了要素集合 (feature collection) 或几何集合 (geometry collection)、索引超出范围、或至少有一个参数为null。
表达式类别: 地理空间 (Geospatial)
声明的参数¶
- N: 要检索的环的索引。索引从1开始,索引0超出范围。索引大于1返回内环。
表达式\ - Polygon: 要检索第N环的多边形。
表达式\
输出类型: Geometry
示例¶
示例1:基本情况¶
参数值:
- N:
n - Polygon:
polygon
| polygon | n | 输出 |
|---|---|---|
| {"type":"Polygon","coordinates":[[[0.0,0.0],[0.0,10.0],[10.0,10.0],[10.0,0.0],[0.0,0.0]]]} | 1 | {"coordinates": [[0.0, 0.0], [0.0, 10.0], [10.0, 10.0], [10.0, 0.0], [0.0, 0.0]], "type": "LineString"} |
| {"type":"Polygon","coordinates":[[[0.0,0.0],[0.0,10.0],[10.0,10.0],[10.0,0.0],[0.0,0.0]]]} | 2 | null |
| {"coordinates":[[[60.0,60.0],[50.0,60.0],[50.0,50.0],[60.0,50.0],[60.0,60.0]],[[57.0,57.0],[55.0,52.0],[52.0,52.0],[50.0,57.0],[57.0,57.0]]],"type":"Polygon"} | 1 | {"coordinates": [[60.0,60.0],[50.0,60.0],[50.0,50.0],[60.0,50.0],[60.0,60.0]], "type": "LineString"} |
| {"coordinates":[[[60.0,60.0],[50.0,60.0],[50.0,50.0],[60.0,50.0],[60.0,60.0]],[[57.0,57.0],[55.0,52.0],[52.0,52.0],[50.0,57.0],[57.0,57.0]]],"type":"Polygon"} | 2 | {"coordinates": [[57.0,57.0],[55.0,52.0],[52.0,52.0],[50.0,57.0],[57.0,57.0]], "type": "LineString"} |
示例2:空值情况¶
参数值:
- N:
n - Polygon:
polygon
| polygon | n | 输出 |
|---|---|---|
| {"coordinates": [[[[2.0, 2.0], [7.0, 2.0], [7.0, 7.0], [2.0, 7.0], [2.0, 2.0]]], [[[12.0, 12.0], [17.0, 12.0], [17.0, 17.0], [12.0, 17.0], [12.0, 12.0]]]], "type":"MultiPolygon"} | 1 | null |
| {"type":"Polygon","coordinates":[[[0.0,0.0],[0.0,10.0],[10.0,10.0],[10.0,0.0],[0.0,0.0]]]} | null | null |
| {"type":"Polygon","coordinates":[[[0.0,0.0],[0.0,10.0],[10.0,10.0],[10.0,0.0],[0.0,0.0]]]} | 0 | null |
| null | 1 | null |
| null | null | null |
示例3:边界情况¶
参数值:
- N:
n - Polygon:
polygon
| polygon | n | 输出 |
|---|---|---|
| {"coordinates":[[[60.0,60.0],[50.0,60.0],[50.0,50.0],[60.0,50.0],[60.0,60.0]],[[57.0,57.0],[55.0,52.... | 1 | {"coordinates": [[60.0,60.0],[50.0,60.0],[50.0,50.0],[60.0,50.0],[60.0,60.0]], "type": "LineString"} |
| {"coordinates":[[[60.0,60.0],[50.0,60.0],[50.0,50.0],[60.0,50.0],[60.0,60.0]],[[57.0,57.0],[55.0,52.... | 2 | {"coordinates": [[57.0,57.0],[55.0,52.0],[52.0,52.0],[50.0,57.0],[57.0,57.0]], "type": "LineString"} |
| {"coordinates":[[[60.0,60.0],[50.0,60.0],[50.0,50.0],[60.0,50.0],[60.0,60.0]],[[57.0,57.0],[55.0,52.... | 3 | {"coordinates": [[58.0,58.0],[58.0,59.0],[59.0,59.0],[59.0,58.0],[58.0,58.0]], "type": "LineString"} |
| {"coordinates":[[[60.0,60.0],[50.0,60.0],[50.0,50.0],[60.0,50.0],[60.0,60.0]],[[57.0,57.0],[55.0,52.... | 4 | {"coordinates": [[52.0,58.5],[56.0,58.5],[54.0,57.5],[52.0,58.5]], "type": "LineString"} |
| {"coordinates":[[[60.0,60.0],[50.0,60.0],[50.0,50.0],[60.0,50.0],[60.0,60.0]],[[57.0,57.0],[55.0,52.... | 5 | null |