ST_WITHIN (Azure Cosmos DB)ST_WITHIN (Azure Cosmos DB)

返回一个布尔表达式,指示在第一个参数中指定的 GeoJSON 对象(点、多边形或 LineString)是否位于第二个参数中的 GeoJSON(点、多边形或 LineString)内。Returns a Boolean expression indicating whether the GeoJSON object (Point, Polygon, or LineString) specified in the first argument is within the GeoJSON (Point, Polygon, or LineString) in the second argument.

语法Syntax

ST_WITHIN (<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

以下示例演示了如何使用 ST_WITHIN 查找某个多边形内的所有家族文档。The following example shows how to find all family documents within a polygon using ST_WITHIN.

SELECT f.id
FROM Families f
WHERE ST_WITHIN(f.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": "WakefieldFamily" }]  

备注Remarks

此系统函数将从地理空间索引中获益。This system function will benefit from a geospatial index.

后续步骤Next steps