Geometry difference

Supported in: Batch, Streaming

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

Expression categories: Geospatial

Declared arguments

  • Geometry a - Geometry b.
    Expression<Geometry>
  • Geometry b - Geometry a.
    Expression<Geometry>

Output type: Geometry

Examples

Example 1: Base case

Argument values:

  • Geometry a: geometry_a
  • Geometry b: geometry_b
geometry_ageometry_bOutput
{"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_ageometry_bOutput
{"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":[]}