ST_Validate
You are viewing an old version of this article. View
the current version here.
MariaDB starting with 11.7
ST_Validate was added in MariaDB 11.7.
Syntax
ST_Validate(g)
Description
The function checks that a given geometry is compliant with the Well-Known Binary (WKB) format and Spatial Reference System Identifier (SRID) syntax, and is geometrically valid.
It returns the geometry if it's valid, or NULL if not.
The function is useful to filter out invalid geometry data.
Examples
A POINT requires both x and y co-ordinates:
SELECT ST_ASTEXT(ST_VALIDATE(ST_GeomFromText('POINT(1 0)'))); +-------------------------------------------------------+ | ST_ASTEXT(ST_VALIDATE(ST_GeomFromText('POINT(1 0)'))) | +-------------------------------------------------------+ | POINT(1 0) | +-------------------------------------------------------+ SELECT ST_ASTEXT(ST_VALIDATE(ST_GeomFromText('POINT(1)'))); +-----------------------------------------------------+ | ST_ASTEXT(ST_VALIDATE(ST_GeomFromText('POINT(1)'))) | +-----------------------------------------------------+ | NULL | +-----------------------------------------------------+
See Also
Comments
Comments loading...
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.