Επεξεργασία

Κοινή χρήση μέσω


ST_ISVALIDDETAILED (NoSQL query)

APPLIES TO: NoSQL

Returns a JSON value containing a Boolean value if the specified GeoJSON Point, Polygon, or LineString expression is valid, and if invalid, the reason.

Syntax

ST_ISVALIDDETAILED(<spatial_expr>)  

Arguments

Description
spatial_expr Any valid GeoJSON Point, Polygon, or LineString expression.

Return types

Returns a JSON object containing a boolean value indicating if the specified GeoJSON point or polygon expression is valid. If invalid, the object additionally contains the reason as a string value.

Examples

The following example how to check validity of multiple objects.

SELECT VALUE {
    valid: ST_ISVALIDDETAILED({ 
        "type": "Point",
        "coordinates": [-84.38876194345323, 33.75682784306348] 
    }),
    invalid: ST_ISVALIDDETAILED({ 
        "type": "Point",
        "coordinates": [133.75682784306348, -184.38876194345323] 
    })
}
[
  {
    "valid": {
      "valid": true
    },
    "invalid": {
      "valid": false,
      "reason": "Latitude values must be between -90 and 90 degrees."
    }
  }
]

Remarks

  • The GeoJSON specification requires that points within a Polygon be specified in counter-clockwise order. A Polygon specified in clockwise order represents the inverse of the region within it.