st_intersection 函数

适用于:检查标记为“是”的 Databricks SQL 检查标记为“是”是 Databricks Runtime 17.1 及更高版本

Important

此功能目前以公共预览版提供。

注释

此功能在 Databricks SQL 经典仓库上不可用。 若要详细了解 Databricks SQL 仓库,请参阅 SQL 仓库类型

将两个输入 GEOMETRY 值的点集交集作为 2D GEOMETRY 值返回。

Syntax

st_intersection ( geoExpr1, geoExpr2 )

Arguments

  • geoExpr1:第一个 GEOMETRY 值。
  • geoExpr2:第二个 GEOMETRY 值。

Returns

类型为GEOMETRY的值,表示两个输入几何体的点集交点。

返回 GEOMETRY 值的 SRID 是输入几何图形的常见 SRID。

如果任何输入为NULL,该函数将返回NULL

错误条件

Examples

-- Returns the intersection of a multipoint and a polygon.
> SELECT st_astext(st_intersection(st_geomfromtext('MULTIPOINT(EMPTY,4 3,5 6,-1 8)'),st_geomfromtext('POLYGON((0 0,10 0,0 10,0 0))')));
  POINT(4 3)
-- Returns the intersection of two overlapping polygons.
> SELECT st_astext(st_intersection(st_geomfromtext('POLYGON((0 0,10 0,10 10,0 10,0 0))'),st_geomfromtext('POLYGON((5 5,15 5,15 15,5 15,5 5))')));
  POLYGON((5 5,10 5,10 10,5 10,5 5))