跳转至

Geometry difference(几何差异(Geometry difference))

Supported in: Batch, Faster, Streaming

Calculates the portion of geometry a that is not intersecting geometry b.

Expression categories: Geospatial

Declared arguments

  • Geometry a: Geometry a.
    Expression\
  • Geometry b: Geometry b.
    Expression\

Output type: Geometry

Examples

Example 1: Base case

Argument values:

  • Geometry a: geometry_a
  • Geometry b: geometry_b
geometry_a geometry_b Output
{"type":"Polygon","coordinates":[[[0.0,0.0],[0.0,1.0],[1.0,1.0],[1.0,0.0],[0.0,0.0]]]} {"type":"Polygon","coordinates":[[[0.25,0.25],[0.5,0.25],[0.5,0.5],[0.25,0.5],[0.25,0.25]]]} {"type":"Polygon","coordinates":[[[0.0,0.0],[0.0,1.0],[1.0,1.0],[1.0,0.0],[0.0,0.0]],[[0.25,0.25],[0.5,0.25],[0.5,0.5],[0.25,0.5],[0.25,0.25]]]}
{"type":"Polygon","coordinates":[[[0.0,0.0],[0.0,1.0],[1.0,1.0],[1.0,0.0],[0.0,0.0]]]} {"type":"Polygon","coordinates":[[[0.0,0.0],[0.5,0.0],[0.5,1.0],[0.0,1.0],[0.0,0.0]]]} {"type":"Polygon","coordinates":[[[0.5,1.0],[1.0,1.0],[1.0,0.0],[0.5,0.0],[0.5,1.0]]]}
{"type":"Polygon","coordinates":[[[0.0,0.0],[0.0,1.0],[1.0,1.0],[1.0,0.0],[0.0,0.0]]]} {"type":"Polygon","coordinates":[[[5.0,5.0],[5.0,6.0],[6.0,6.0],[6.0,5.0],[5.0,5.0]]]} {"type":"Polygon","coordinates":[[[0.0,0.0],[0.0,1.0],[1.0,1.0],[1.0,0.0],[0.0,0.0]]]}
{"type":"Polygon","coordinates":[[[0.0,0.0],[0.0,1.0],[1.0,1.0],[1.0,0.0],[0.0,0.0]]]} {"type":"LineString","coordinates":[[0.0,0.0],[0.0,1.0]]} {"type":"Polygon","coordinates":[[[0.0,0.0],[0.0,1.0],[1.0,1.0],[1.0,0.0],[0.0,0.0]]]}

Example 2: Edge case

Argument values:

  • Geometry a: geometry_a
  • Geometry b: geometry_b
geometry_a geometry_b Output
{"type":"Point","coordinates":[0.0,0.0]} {"type":"Point","coordinates":[0.0,0.0]} {"type":"Point","coordinates":[]}
{"type":"Polygon","coordinates":[[[0.0,0.0],[0.0,1.0],[1.0,1.0],[1.0,0.0],[0.0,0.0]]]} {"type":"Polygon","coordinates":[[[0.0,0.0],[0.0,1.0],[1.0,1.0],[1.0,0.0],[0.0,0.0]]]} {"type":"Polygon","coordinates":[[]]}
{"type":"Point","coordinates":[0.0,0.0]} {"type":"LineString","coordinates":[[0.0,0.0],[0.0,1.0]]} {"type":"Point","coordinates":[]}
{"type":"LineString","coordinates":[[0.0,0.0],[0.0,1.0]]} {"type":"Polygon","coordinates":[[[0.0,0.0],[0.0,1.0],[1.0,1.0],[1.0,0.0],[0.0,0.0]]]} {"type":"LineString","coordinates":[]}


中文翻译


几何差异(Geometry difference)

支持:批处理(Batch)、快速处理(Faster)、流处理(Streaming)

计算几何体 a 中不与几何体 b 相交的部分。

表达式类别: 地理空间(Geospatial)

声明的参数

  • 几何体 a(Geometry a): 几何体 a。
    表达式\
  • 几何体 b(Geometry b): 几何体 b。
    表达式\

输出类型: Geometry

示例

示例 1:基本情形

参数值:

  • 几何体 a: geometry_a
  • 几何体 b: geometry_b
geometry_a geometry_b 输出
{"type":"Polygon","coordinates":[[[0.0,0.0],[0.0,1.0],[1.0,1.0],[1.0,0.0],[0.0,0.0]]]} {"type":"Polygon","coordinates":[[[0.25,0.25],[0.5,0.25],[0.5,0.5],[0.25,0.5],[0.25,0.25]]]} {"type":"Polygon","coordinates":[[[0.0,0.0],[0.0,1.0],[1.0,1.0],[1.0,0.0],[0.0,0.0]],[[0.25,0.25],[0.5,0.25],[0.5,0.5],[0.25,0.5],[0.25,0.25]]]}
{"type":"Polygon","coordinates":[[[0.0,0.0],[0.0,1.0],[1.0,1.0],[1.0,0.0],[0.0,0.0]]]} {"type":"Polygon","coordinates":[[[0.0,0.0],[0.5,0.0],[0.5,1.0],[0.0,1.0],[0.0,0.0]]]} {"type":"Polygon","coordinates":[[[0.5,1.0],[1.0,1.0],[1.0,0.0],[0.5,0.0],[0.5,1.0]]]}
{"type":"Polygon","coordinates":[[[0.0,0.0],[0.0,1.0],[1.0,1.0],[1.0,0.0],[0.0,0.0]]]} {"type":"Polygon","coordinates":[[[5.0,5.0],[5.0,6.0],[6.0,6.0],[6.0,5.0],[5.0,5.0]]]} {"type":"Polygon","coordinates":[[[0.0,0.0],[0.0,1.0],[1.0,1.0],[1.0,0.0],[0.0,0.0]]]}
{"type":"Polygon","coordinates":[[[0.0,0.0],[0.0,1.0],[1.0,1.0],[1.0,0.0],[0.0,0.0]]]} {"type":"LineString","coordinates":[[0.0,0.0],[0.0,1.0]]} {"type":"Polygon","coordinates":[[[0.0,0.0],[0.0,1.0],[1.0,1.0],[1.0,0.0],[0.0,0.0]]]}

示例 2:边界情形

参数值:

  • 几何体 a: geometry_a
  • 几何体 b: geometry_b
geometry_a geometry_b 输出
{"type":"Point","coordinates":[0.0,0.0]} {"type":"Point","coordinates":[0.0,0.0]} {"type":"Point","coordinates":[]}
{"type":"Polygon","coordinates":[[[0.0,0.0],[0.0,1.0],[1.0,1.0],[1.0,0.0],[0.0,0.0]]]} {"type":"Polygon","coordinates":[[[0.0,0.0],[0.0,1.0],[1.0,1.0],[1.0,0.0],[0.0,0.0]]]} {"type":"Polygon","coordinates":[[]]}
{"type":"Point","coordinates":[0.0,0.0]} {"type":"LineString","coordinates":[[0.0,0.0],[0.0,1.0]]} {"type":"Point","coordinates":[]}
{"type":"LineString","coordinates":[[0.0,0.0],[0.0,1.0]]} {"type":"Polygon","coordinates":[[[0.0,0.0],[0.0,1.0],[1.0,1.0],[1.0,0.0],[0.0,0.0]]]} {"type":"LineString","coordinates":[]}