Parse KML string as geometry list(将 KML 字符串解析为几何图形列表(Parse KML string as geometry list))¶
Supported in: Batch, Streaming
Parses KML string as a list of GeoJSONs, ignoring all KML attributes.
Expression categories: Geospatial
Declared arguments¶
- KML string to parse: Valid KML string to parse to geometry.
Expression\ - optional Output mode: Choose whether to output null on an erroneous output, or a result type from which you can extract the 'ok' field to get the geometry list or the 'error' field to get a descriptive error message. This will also apply to all of the geometries inside the list.
Enum\ - optional Prepare geometry after parse: Choose whether the KML should be prepared to adhere to Foundry geometry semantics. It is recommended to prepare in most cases to prevent failure during ontology indexing. Preparing will null out invalid geometries, for example those with out of bounds coordinates.
Literal\
Output type: Array\
Examples¶
Example 1: Base case¶
Argument values:
- KML string to parse:
col - Output mode:
simple - Prepare geometry after parse: true
| col | Output |
|---|---|
| \ \ \<Do... |
[ {"coordinates":[[-122.43193945401, 37.801983684521], [-122.431564131101, 37.8020327731402], [-122.43... ] |
Example 2: Base case¶
Argument values:
- KML string to parse:
col - Output mode:
simple - Prepare geometry after parse: false
| col | Output |
|---|---|
| \ \ \<Do... |
[ {"coordinates":[[-122.43193945401, 37.801983684521], [-122.431564131101, 37.8020327731402], [-122.43... ] |
Example 3: Base case¶
Argument values:
- KML string to parse:
col - Output mode:
with_errors - Prepare geometry after parse: true
| col | Output |
|---|---|
| \ \ \<Do... |
{ error: null, ok: [ { error: null, ok: {"ty... |
Example 4: Base case¶
Argument values:
- KML string to parse:
col - Output mode:
with_errors - Prepare geometry after parse: false
| col | Output |
|---|---|
| \ \ \<Do... |
{ error: null, ok: [ { error: null, ok: {"ty... |
Example 5: Base case¶
Argument values:
- KML string to parse:
col - Output mode:
simple - Prepare geometry after parse: false
| col | Output |
|---|---|
| randomKmlFileString | null |
Example 6: Base case¶
Argument values:
- KML string to parse:
col - Output mode:
with_errors - Prepare geometry after parse: false
| col | Output |
|---|---|
| randomKmlFileString | { error: Failed to parse String. Error: Unexpected character 'r' (code 114) in prolog; expected '<' at [row,col {unknown-source}]: [1,1], ok: null, } |
Example 7: Null case¶
Argument values:
- KML string to parse:
col - Output mode:
simple - Prepare geometry after parse: false
| col | Output |
|---|---|
| null | null |
Example 8: Null case¶
Argument values:
- KML string to parse:
col - Output mode:
with_errors - Prepare geometry after parse: false
| col | Output |
|---|---|
| null | { error: Null input: KML, ok: null, } |
中文翻译¶
将 KML 字符串解析为几何图形列表(Parse KML string as geometry list)¶
支持:批处理(Batch)、流处理(Streaming)
将 KML 字符串解析为 GeoJSON 列表,忽略所有 KML 属性。
表达式类别: 地理空间(Geospatial)
声明的参数(Declared arguments)¶
- 要解析的 KML 字符串: 要解析为几何图形的有效 KML 字符串。
表达式\ - 可选 输出模式(Output mode): 选择在输出错误时返回 null,还是返回一个结果类型,从中可以提取 'ok' 字段以获取几何图形列表,或提取 'error' 字段以获取描述性错误消息。此设置也将应用于列表中的所有几何图形。
枚举\ - 可选 解析后准备几何图形(Prepare geometry after parse): 选择是否应准备 KML 以符合 Foundry 几何图形语义。建议在大多数情况下进行准备,以防止在本体索引(ontology indexing)期间发生失败。准备操作将使无效的几何图形(例如坐标超出边界的几何图形)变为 null。
字面量\
输出类型: 数组\
示例¶
示例 1:基本情况¶
参数值:
- 要解析的 KML 字符串:
col - 输出模式:
simple - 解析后准备几何图形: true
| col | 输出 |
|---|---|
| \ \ \<Do... |
[ {"coordinates":[[-122.43193945401, 37.801983684521], [-122.431564131101, 37.8020327731402], [-122.43... ] |
示例 2:基本情况¶
参数值:
- 要解析的 KML 字符串:
col - 输出模式:
simple - 解析后准备几何图形: false
| col | 输出 |
|---|---|
| \ \ \<Do... |
[ {"coordinates":[[-122.43193945401, 37.801983684521], [-122.431564131101, 37.8020327731402], [-122.43... ] |
示例 3:基本情况¶
参数值:
- 要解析的 KML 字符串:
col - 输出模式:
with_errors - 解析后准备几何图形: true
| col | 输出 |
|---|---|
| \ \ \<Do... |
{ error: null, ok: [ { error: null, ok: {"ty... |
示例 4:基本情况¶
参数值:
- 要解析的 KML 字符串:
col - 输出模式:
with_errors - 解析后准备几何图形: false
| col | 输出 |
|---|---|
| \ \ \<Do... |
{ error: null, ok: [ { error: null, ok: {"ty... |
示例 5:基本情况¶
参数值:
- 要解析的 KML 字符串:
col - 输出模式:
simple - 解析后准备几何图形: false
| col | 输出 |
|---|---|
| randomKmlFileString | null |
示例 6:基本情况¶
参数值:
- 要解析的 KML 字符串:
col - 输出模式:
with_errors - 解析后准备几何图形: false
| col | 输出 |
|---|---|
| randomKmlFileString | { error: Failed to parse String. Error: Unexpected character 'r' (code 114) in prolog; expected '<' at [row,col {unknown-source}]: [1,1], ok: null, } |
示例 7:空值情况¶
参数值:
- 要解析的 KML 字符串:
col - 输出模式:
simple - 解析后准备几何图形: false
| col | 输出 |
|---|---|
| null | null |
示例 8:空值情况¶
参数值:
- 要解析的 KML 字符串:
col - 输出模式:
with_errors - 解析后准备几何图形: false
| col | 输出 |
|---|---|
| null | { error: Null input: KML, ok: null, } |