These functions take as arguments a Well-Known Text (WKT) representation and, optionally, a spatial reference system identifier (SRID). They return the corresponding geometry.
ST_GeomFromText() accepts a WKT
value of any geometry type as its first argument. Other functions
provide type-specific construction functions for construction of
geometry values of each geometry type.
For a description of WKT format, see Well-Known Text (WKT) Format.
GeomCollFromText(,wkt[,srid])GeometryCollectionFromText(wkt[,srid])ST_GeomCollFromText(),ST_GeometryCollectionFromText(),ST_GeomCollFromTxt(),GeomCollFromText(), andGeometryCollectionFromText()are synonyms. For more information, see the description ofST_GeomCollFromText().GeomCollFromText()andGeometryCollectionFromText()are deprecated; expect them to be removed in a future MySQL release. UseST_GeomCollFromText()andST_GeometryCollectionFromText()instead.GeomFromText(,wkt[,srid])GeometryFromText(wkt[,srid])ST_GeomFromText(),ST_GeometryFromText(),GeomFromText(), andGeometryFromText()are synonyms. For more information, see the description ofST_GeomFromText().GeomFromText()andGeometryFromText()are deprecated; expect them to be removed in a future MySQL release. UseST_GeomFromText()andST_GeometryFromText()instead.LineFromText(,wkt[,srid])LineStringFromText(wkt[,srid])ST_LineFromText(),ST_LineStringFromText(),LineFromText(), andLineStringFromText()are synonyms. For more information, see the description ofST_LineFromText().LineFromText()andLineStringFromText()are deprecated; expect them to be removed in a future MySQL release. UseST_LineFromText()andST_LineStringFromText()instead.MLineFromText(,wkt[,srid])MultiLineStringFromText(wkt[,srid])ST_MLineFromText(),ST_MultiLineStringFromText(),MLineFromText(), andMultiLineStringFromText()are synonyms. For more information, see the description ofST_MLineFromText().MLineFromText()andMultiLineStringFromText()are deprecated; expect them to be removed in a future MySQL release. UseST_MLineFromText()andST_MultiLineStringFromText()instead.MPointFromText(,wkt[,srid])MultiPointFromText(wkt[,srid])ST_MPointFromText(),ST_MultiPointFromText(),MPointFromText(), andMultiPointFromText()are synonyms. For more information, see the description ofST_MPointFromText().MPointFromText()andMultiPointFromText()are deprecated; expect them to be removed in a future MySQL release. UseST_MPointFromText()andST_MultiPointFromText()instead.MPolyFromText(,wkt[,srid])MultiPolygonFromText(wkt[,srid])ST_MPolyFromText(),ST_MultiPolygonFromText(),MPolyFromText(), andMultiPolygonFromText()are synonyms. For more information, see the description ofST_MPolyFromText().MPolyFromText()andMultiPolygonFromText()are deprecated; expect them to be removed in a future MySQL release. UseST_MPolyFromText()andST_MultiPolygonFromText()instead.ST_PointFromText()andPointFromText()are synonyms. For more information, see the description ofST_PointFromText().PointFromText()is deprecated; expect it to be removed in a future MySQL release. UseST_PointFromText()instead.PolyFromText(,wkt[,srid])PolygonFromText(wkt[,srid])ST_PolyFromText(),ST_PolygonFromText(),PolyFromText(), andPolygonFromText()are synonyms. For more information, see the description ofST_PolyFromText().PolyFromText()andPolygonFromText()are deprecated; expect them to be removed in a future MySQL release. UseST_PolyFromText()andST_PolygonFromText()instead.ST_GeomCollFromText(,wkt[,srid])ST_GeometryCollectionFromText(,wkt[,srid])ST_GeomCollFromTxt(wkt[,srid])Constructs a
GeometryCollectionvalue using its WKT representation and SRID.If the geometry argument is
NULLor not a syntactically well-formed geometry, or if the SRID argument isNULL, the return value isNULL.mysql> SET @g = "MULTILINESTRING((10 10, 11 11), (9 9, 10 10))"; mysql> SELECT ST_AsText(ST_GeomCollFromText(@g)); +--------------------------------------------+ | ST_AsText(ST_GeomCollFromText(@g)) | +--------------------------------------------+ | MULTILINESTRING((10 10,11 11),(9 9,10 10)) | +--------------------------------------------+ST_GeomCollFromText(),ST_GeometryCollectionFromText(),ST_GeomCollFromTxt(),GeomCollFromText(), andGeometryCollectionFromText()are synonyms.ST_GeomFromText(,wkt[,srid])ST_GeometryFromText(wkt[,srid])Constructs a geometry value of any type using its WKT representation and SRID.
If the geometry argument is
NULLor not a syntactically well-formed geometry, or if the SRID argument isNULL, the return value isNULL.ST_GeomFromText(),ST_GeometryFromText(),GeomFromText(), andGeometryFromText()are synonyms.ST_LineFromText(,wkt[,srid])ST_LineStringFromText(wkt[,srid])Constructs a
LineStringvalue using its WKT representation and SRID.If the geometry argument is
NULLor not a syntactically well-formed geometry, or if the SRID argument isNULL, the return value isNULL.ST_LineFromText(),ST_LineStringFromText(),LineFromText(), andLineStringFromText()are synonyms.ST_MLineFromText(,wkt[,srid])ST_MultiLineStringFromText(wkt[,srid])Constructs a
MultiLineStringvalue using its WKT representation and SRID.If the geometry argument is
NULLor not a syntactically well-formed geometry, or if the SRID argument isNULL, the return value isNULL.ST_MLineFromText(),ST_MultiLineStringFromText(),MLineFromText(), andMultiLineStringFromText()are synonyms.ST_MPointFromText(,wkt[,srid])ST_MultiPointFromText(wkt[,srid])Constructs a
MultiPointvalue using its WKT representation and SRID.If the geometry argument is
NULLor not a syntactically well-formed geometry, or if the SRID argument isNULL, the return value isNULL.Functions such as
ST_MPointFromText()andST_GeomFromText()that accept WKT-format representations ofMultiPointvalues permit individual points within values to be surrounded by parentheses. For example, both of the following function calls are valid:ST_MPointFromText('MULTIPOINT (1 1, 2 2, 3 3)') ST_MPointFromText('MULTIPOINT ((1 1), (2 2), (3 3))')ST_MPointFromText(),ST_MultiPointFromText(),MPointFromText(), andMultiPointFromText()are synonyms.ST_MPolyFromText(,wkt[,srid])ST_MultiPolygonFromText(wkt[,srid])Constructs a
MultiPolygonvalue using its WKT representation and SRID.If the geometry argument is
NULLor not a syntactically well-formed geometry, or if the SRID argument isNULL, the return value isNULL.ST_MPolyFromText(),ST_MultiPolygonFromText(),MPolyFromText(), andMultiPolygonFromText()are synonyms.ST_PointFromText(wkt[,srid])Constructs a
Pointvalue using its WKT representation and SRID.If the geometry argument is
NULLor not a syntactically well-formed geometry, or if the SRID argument isNULL, the return value isNULL.ST_PointFromText()andPointFromText()are synonyms.ST_PolyFromText(,wkt[,srid])ST_PolygonFromText(wkt[,srid])Constructs a
Polygonvalue using its WKT representation and SRID.If the geometry argument is
NULLor not a syntactically well-formed geometry, or if the SRID argument isNULL, the return value isNULL.ST_PolyFromText(),ST_PolygonFromText(),PolyFromText(), andPolygonFromText()are synonyms.