Geometry
Property Analysis Functions
MySQL supports the following functions for converting geometry values between internal format and either WKT or WKB format:
GeomFromText(wkt[,srid])
PointFromText()
and LineFromText()
; see
section 11.4.2.1 Creating Geometry Values Using WKT Functions.
GeomFromWKB(wkb[,srid])
PointFromWKB()
and LineFromWKB()
; see
section 11.4.2.2 Creating Geometry Values Using WKB Functions.
AsText(g)
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)