The following sections describe functions that take geometry values as arguments and return new geometry values.
Section 12.18.5.2, “Geometry Property Functions”, discusses
several functions that construct new geometries from existing
ones. See that section for descriptions of these functions:
OpenGIS proposes a number of other functions that can produce geometries. They are designed to implement spatial operators.
Returns a geometry that represents all points whose
distance from the geometry value
g is less than or equal to a
distance of d.
Buffer() supports negative
distances for polygons, multipolygons, and geometry
collections containing polygons or multipolygons. For
point, multipoint, linestring, multilinestring, and
geometry collections not containing any polygons or
multipolygons, Buffer()
with a negative distance returns NULL.
Prior to MySQL 5.6.1, this function is unimplemented.
The OpenGIS specification also defines the following functions, which MySQL does not implement:
Returns a geometry that represents the convex hull of the
geometry value g.
Returns a geometry that represents the point set
difference of the geometry value
g1 with
g2.
Returns a geometry that represents the point set
intersection of the geometry values
g1 with
g2.
Returns a geometry that represents the point set symmetric
difference of the geometry value
g1 with
g2.
Returns a geometry that represents the point set union of
the geometry values g1 and
g2.

User Comments
We work a lot with LineString columns in our project (http://www.sunnyrentals.com).
To make it easier to get Nth line from the LineString, we use this function (similar to PointN):
DELIMITER //
DROP FUNCTION IF EXISTS LineN; //
CREATE FUNCTION LineN(ls LINESTRING, n INT) RETURNS LINESTRING NO SQL DETERMINISTIC
BEGIN
IF n >= numPoints(ls) THEN
RETURN NULL;
END IF;
RETURN LineString(PointN(ls, n), PointN(ls, n+1));
END; //
Add your own comment.