База данных: MySQL


Returns 1 if the argument is geometrically valid, 0 if the argument is
not geometrically valid. Geometry validity is defined by the OGC

The only valid empty geometry is represented in the form of an empty
geometry collection value. ST_IsValid() returns 1 in this case. MySQL
does not support GIS EMPTY values such as POINT EMPTY.

ST_IsValid() handles its arguments as described in the introduction to
this section, with this exception:

o If the geometry has a geographic SRS with a longitude or latitude
that is out of range, an error occurs:

o If a longitude argument is not in the range (?180, 180], an
ce.html#error_er_geometry_param_longitude_out_of_range) error
ce.html#error_er_longitude_out_of_range) prior to MySQL 8.0.12).

o If a latitude argument is not in the range [?90, 90], an
ce.html#error_er_geometry_param_latitude_out_of_range) error occurs
ce.html#error_er_latitude_out_of_range) prior to MySQL 8.0.12).

Ranges shown are in degrees. If an SRS uses another unit, the range
uses the corresponding values in its unit. The exact range limits
deviate slightly due to floating-point arithmetic.

URL: https://dev.mysql.com/doc/refman/8.0/en/spatial-convenience-functions.html


mysql> SET @ls1 = ST_GeomFromText('LINESTRING(0 0,-0.00 0,0.0 0)');
mysql> SET @ls2 = ST_GeomFromText('LINESTRING(0 0, 1 1)');
mysql> SELECT ST_IsValid(@ls1);
| ST_IsValid(@ls1) |
| 0 |
mysql> SELECT ST_IsValid(@ls2);
| ST_IsValid(@ls2) |
| 1 |