functions-that-create-new-geometries-from-existing-ones

This page has moved or been replaced. The new page is located here:

http://dev.mysql.com/doc/refman/5.0/en/gis-property-functions.html

Please update any bookmarks that point to the old page.


User Comments
  Posted by ALEXANDER SKAKUNOV on July 2, 2012
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; //

Sign Up Login You must be logged in to post a comment.