跳转至
🎉 SedonaDB 0.4.0 已正式发布!🗺️ 新增 Python DataFrame API、R dplyr 接口、Geography 支持及 GPU 加速空间连接。阅读发布博客 →

ST_Intersection

Introduction: Return the intersection geometry of A and B

ST_Intersection

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

Return type: Geometry

Since: v1.5.0

Note

If you encounter a TopologyException with the message "found non-noded intersection", try enabling the OverlayNG algorithm by adding the following JVM flag:

-Djts.overlay=ng

The OverlayNG algorithm is more robust than the legacy overlay implementation in JTS and handles many edge cases that would otherwise cause errors.

Example:

SELECT ST_Intersection(
    ST_GeomFromWKT("POLYGON((1 1, 8 1, 8 8, 1 8, 1 1))"),
    ST_GeomFromWKT("POLYGON((2 2, 9 2, 9 9, 2 9, 2 2))")
    )

Output:

POLYGON ((2 8, 8 8, 8 2, 2 2, 2 8))