ST_INTERSECTS (Azure Cosmos DB)ST_INTERSECTS (Azure Cosmos DB)

适用于: SQL API

返回一个布尔表达式,指示在第一个参数中指定的 GeoJSON 对象(Point、Polygon、MultiPolygon 或 LineString)是否与第二个参数中的 GeoJSON(Point、Polygon、MultiPolygon 或 LineString)相交。Returns a Boolean expression indicating whether the GeoJSON object (Point, Polygon, MultiPolygon, or LineString) specified in the first argument intersects the GeoJSON (Point, Polygon, MultiPolygon, or LineString) in the second argument.

语法Syntax

ST_INTERSECTS (<spatial_expr>, <spatial_expr>)  

参数Arguments

spatial_exprspatial_expr
是 GeoJSON 点、多边形或 LineString 对象表达式。Is a GeoJSON Point, Polygon, or LineString object expression.

返回类型Return types

返回一个布尔值。Returns a Boolean value.

示例Examples

以下示例介绍了如何查找与给定多边形相交的所有区域。The following example shows how to find all areas that intersect with the given polygon.

SELECT a.id
FROM Areas a
WHERE ST_INTERSECTS(a.location, {  
    'type':'Polygon',
    'coordinates': [[[31.8, -5], [32, -5], [32, -4.7], [31.8, -4.7], [31.8, -5]]]  
})  

下面是结果集。Here is the result set.

[{ "id": "IntersectingPolygon" }]  

备注Remarks

此系统函数将从地理空间索引中获益(包含聚合的查询除外)。This system function will benefit from a geospatial index except in queries with aggregates.

后续步骤Next steps