STV_IsValidReason

Determines if a spatial object is well formed or valid. If the object is not valid, STV_IsValidReason returns a string that explains where the invalidity occurs.

A polygon or multipolygon is valid if all of the following are true:

If you pass an invalid object to a Vertica Place function, the function fails or returns incorrect results. To determine if a polygon is valid, first run ST_IsValid. ST_IsValid returns TRUE if the polygon is valid, FALSE otherwise.

Important: STV_IsValidReason supports only polygon and multipolygon GEOMETRY data types.

Behavior Type

Immutable

Syntax

STV_IsValidReason( g )

Arguments

g

Geospatial object to test for validity, value of type GEOMETRY or GEOGRAPHY (WGS84).

Returns

LONG VARCHAR

Supported Data Types

Data Type GEOMETRY GEOGRAPHY (Perfect Sphere) GEOGRAPHY (WGS84)
Point Yes No No
Multipoint Yes No No
Linestring Yes No No
Multilinestring Yes No No
Polygon Yes No Yes
Multipolygon Yes No No
GeometryCollection

Yes

No No

Example

The following example shows how to use STV_IsValidReason.

Returns a string describing where the polygon is invalid:

=> SELECT STV_IsValidReason(ST_GeomFromText('POLYGON((1 3,3 2,1 1,
   3 0,1 0,1 3))'));
               STV_IsValidReason               
-----------------------------------------------
 Ring Self-intersection at or near POINT (1 1)
(1 row)

See Also

ST_IsValid