MySQL Reference Manual for version 4.0.18.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

17.5.1 Geometry Format Conversion Functions

MySQL supports the following functions for converting geometry values between internal format and either WKT or WKB format:

GeomFromText(wkt[,srid])
Converts a string value from its WKT representation into internal geometry format and returns the result. A number of type-specific functions are also supported, such as PointFromText() and LineFromText(); see 17.4.2.1 Creating Geometry Values Using WKT Functions.

GeomFromWKB(wkb[,srid])
Converts a binary value from its WKB representation into internal geometry format and returns the result. A number of type-specific functions are also supported, such as PointFromWKB() and LineFromWKB(); see 17.4.2.2 Creating Geometry Values Using WKB Functions.

AsText(g)
Converts a value in internal geometry format to its WKT representation and returns the string result.

 
mysql> SET @g = 'LineString(1 1,2 2,3 3)';
mysql> SELECT AsText(GeomFromText(@g));
+--------------------------+
| AsText(GeomFromText(@G)) |
+--------------------------+
| LINESTRING(1 1,2 2,3 3)  |
+--------------------------+

AsBinary(g)
Converts a value in internal geometry format to its WKB representation and returns the binary result.



This document was generated by rdg (Feb 25 2004) using texi2html