ST_ISVALIDDETAILED (Azure Cosmos DB)ST_ISVALIDDETAILED (Azure Cosmos DB)
适用于:
SQL API
如果指定的 GeoJSON 点、多边形或 LineString 表达式有效,则返回包含布尔值的 JSON 值;如果无效,则额外加上作为字符串值的原因。Returns a JSON value containing a Boolean value if the specified GeoJSON Point, Polygon, or LineString expression is valid, and if invalid, additionally the reason as a string value.
语法Syntax
ST_ISVALIDDETAILED(<spatial_expr>)
参数Arguments
spatial_exprspatial_expr
是 GeoJSON 点或多边形表达式。Is a GeoJSON point or polygon expression.
返回类型Return types
如果指定的 GeoJSON 点或多边形表达式有效,则返回包含布尔值的 JSON 值;如果无效,则额外添加原因作为字符串值。Returns a JSON value containing a Boolean value if the specified GeoJSON point or polygon expression is valid, and if invalid, additionally the reason as a string value.
示例Examples
以下示例演示了如何使用 ST_ISVALIDDETAILED
检查有效性(带详细信息)。The following example how to check validity (with details) using ST_ISVALIDDETAILED
.
SELECT ST_ISVALIDDETAILED({
"type": "Polygon",
"coordinates": [[ [ 31.8, -5 ], [ 31.8, -4.7 ], [ 32, -4.7 ], [ 32, -5 ] ]]
}) AS b
下面是结果集:Here is the result set.
[{
"b": {
"valid": false,
"reason": "The Polygon input is not valid because the start and end points of the ring number 1 are not the same. Each ring of a polygon must have the same start and end points."
}
}]