Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 17 » SQL Anywhere Server - Spatial Data Support » Spatial types and functions » ST_Geometry type

ST_IsValid method

Determines whether the geometry is a valid spatial object.

Syntax
geometry-expression.ST_IsValid()
Returns
  • BIT

    Returns 1 if the geometry value is valid, otherwise 0.

Remarks

By default, the server does not validate spatial data as it is created or imported from other formats. The ST_IsValid method can be used to verify that the imported data represents a geometry that is valid. Operations on invalid geometries return undefined results.

Standards
  • SQL/MM (ISO/IEC 13249-3: 2006)

    5.1.9

Example

The following returns the result 0 because the polygon contains a bow tie (the ring has a self-intersection).

SELECT NEW ST_Polygon( 'Polygon(( 0 0, 4 0, 4 5, 0 -1, 0 0 ))' )
	.ST_IsValid()

The following returns the result 0 because the polygons within the geometry self-intersect at a surface. Self-intersections of a geometry collection at finite number of points is considered valid.

SELECT NEW ST_MultiPolygon( 'MultiPolygon((( 0 0, 2 0, 1 2, 0 0 )),((0 2, 1 0, 2 2, 0 2)))' )
	            .ST_IsValid()