•Polygon rings can be specified both clockwise and counterclockwise. MySQL flips the rings automatically when reading data. 

Cartesian coordinates are stored in the length unit of the spatial reference system, with X values in the X coordinates and Y values in the Y coordinates. Axis directions are those specified by the spatial reference system. 

Geographic coordinates are stored in the angle unit of the spatial reference system, with longitudes in the X coordinates and latitudes in the Y coordinates. Axis directions and the meridian are those specified by the spatial reference system. 

The LENGTH()  function returns the space in bytes required for value storage. Example: 

mysql> SET @g = ST_GeomFromText(’POINT(1 -1)’); mysql> SELECT LENGTH(@g); +------------+ | LENGTH(@g) | +------------+ | 25 | +------------+ mysql> SELECT HEX(@g); +----------------------------------------------------+ | HEX(@g) | +----------------------------------------------------+ | 000000000101000000000000000000F03F000000000000F0BF | +----------------------------------------------------+ 

The value length is 25 bytes, made up of these components (as can be seen from the hexadecimal value): 

## 11.4.4 Geometry Well-Formedness and Validity 

•4 bytes for integer SRID (0) 

•1 byte for integer byte order (1 = little-endian) 

•4 bytes for integer type information (1 = Point ) 

•8 bytes for double-precision X coordinate (1) 

• 8 bytes for double-precision Y coordinate ( − 1) 

For geometry values, MySQL distinguishes between the concepts of syntactically well-formed and geometrically valid. 

A geometry is syntactically well-formed if it satisfies conditions such as those in this (nonexhaustive) list: 

•Linestrings have at least two points 

•Polygons have at least one ring 

•Polygon rings are closed (first and last points the same) 

•Polygon rings have at least 4 points (minimum polygon is a triangle with first and last points the same) 

•Collections are not empty (except GeometryCollection ) 

A geometry is geometrically valid if it is syntactically well-formed and satisfies conditions such as those in this (nonexhaustive) list: 

•Polygons are not self-intersecting 

