跳转至
🎉 Apache Sedona 1.9.1 已正式发布!🗺️ 新增 Geography SQL 函数、Box2D 与 Box3D 类型、栅格 Python UDF 等。查看发布说明 →

ST_Difference

Introduction: Return the difference between geometry A and B (return part of geometry A that does not intersect geometry B)

ST_Difference

Format: ST_Difference (A: Geometry, B: Geometry)

Return type: Geometry

Since: v1.2.0

SQL Example

SELECT ST_Difference(ST_GeomFromWKT('POLYGON ((-3 -3, 3 -3, 3 3, -3 3, -3 -3))'), ST_GeomFromWKT('POLYGON ((0 -4, 4 -4, 4 4, 0 4, 0 -4))'))

Output:

POLYGON ((0 -3, -3 -3, -3 3, 0 3, 0 -3))