Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Applies to:
Databricks SQL
Databricks Runtime 17.1 and above
Important
This feature is in Public Preview.
Note
This feature is not available on Databricks SQL Classic warehouses. To learn more about Databricks SQL warehouses, see SQL warehouse types.
Returns the point-set intersection of the two input GEOMETRY values as a 2D GEOMETRY value.
Syntax
st_intersection ( geoExpr1, geoExpr2 )
Arguments
geoExpr1: The firstGEOMETRYvalue.geoExpr2: The secondGEOMETRYvalue.
Returns
A value of type GEOMETRY, representing the point-set intersection of the two input geometries.
The SRID of the returned GEOMETRY value is the common SRID of the input geometries.
The function returns NULL if any of the inputs is NULL.
Error conditions
- If any of the two input geometries is a geometry collection, the function returns ST_INVALID_ARGUMENT.INVALID_TYPE.
- If the two input geometries have different SRID values, the function returns ST_DIFFERENT_SRID_VALUES.
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))