DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

(mysql.info.gz) Linestring property functions

Info Catalog (mysql.info.gz) Point property functions (mysql.info.gz) Geometry property functions (mysql.info.gz) Multilinestring property functions
 
 18.5.2.3 `LineString' Functions
 ...............................
 
 A `LineString' consists of `Point' values. You can extract particular
 points of a `LineString', count the number of points that it contains,
 or obtain its length.
 
 `EndPoint(LS)'
      Returns the `Point' that is the end point of the `LineString' value
      LS.
 
           mysql> SET @ls = 'LineString(1 1,2 2,3 3)';
           mysql> SELECT AsText(EndPoint(GeomFromText(@ls)));
           +-------------------------------------+
           | AsText(EndPoint(GeomFromText(@ls))) |
           +-------------------------------------+
           | POINT(3 3)                          |
           +-------------------------------------+
 
 `GLength(LS)'
      Returns as a double-precision number the length of the `LineString'
      value LS in its associated spatial reference.
 
           mysql> SET @ls = 'LineString(1 1,2 2,3 3)';
           mysql> SELECT GLength(GeomFromText(@ls));
           +----------------------------+
           | GLength(GeomFromText(@ls)) |
           +----------------------------+
           |            2.8284271247462 |
           +----------------------------+
 
 `IsClosed(LS)'
      Returns 1 if the `LineString' value LS is closed (that is, its
      `StartPoint()' and `EndPoint()' values are the same).  Returns 0
      if LS is not closed, and -1 if it is `NULL'.
 
           mysql> SET @ls = 'LineString(1 1,2 2,3 3)';
           mysql> SELECT IsClosed(GeomFromText(@ls));
           +-----------------------------+
           | IsClosed(GeomFromText(@ls)) |
           +-----------------------------+
           |                           0 |
           +-----------------------------+
 
 `NumPoints(LS)'
      Returns the number of points in the `LineString' value LS.
 
           mysql> SET @ls = 'LineString(1 1,2 2,3 3)';
           mysql> SELECT NumPoints(GeomFromText(@ls));
           +------------------------------+
           | NumPoints(GeomFromText(@ls)) |
           +------------------------------+
           |                            3 |
           +------------------------------+
 
 `PointN(LS,N)'
      Returns the N-th point in the `Linestring' value LS.  Point
      numbers begin at 1.
 
           mysql> SET @ls = 'LineString(1 1,2 2,3 3)';
           mysql> SELECT AsText(PointN(GeomFromText(@ls),2));
           +-------------------------------------+
           | AsText(PointN(GeomFromText(@ls),2)) |
           +-------------------------------------+
           | POINT(2 2)                          |
           +-------------------------------------+
 
 `StartPoint(LS)'
      Returns the `Point' that is the start point of the `LineString'
      value LS.
 
           mysql> SET @ls = 'LineString(1 1,2 2,3 3)';
           mysql> SELECT AsText(StartPoint(GeomFromText(@ls)));
           +---------------------------------------+
           | AsText(StartPoint(GeomFromText(@ls))) |
           +---------------------------------------+
           | POINT(1 1)                            |
           +---------------------------------------+
 
 
 The OpenGIS specification also defines the following function, which
 MySQL does not implement:
 
 `IsRing(LS)'
      Returns 1 if the `LineString' value LS is closed (that is, its
      `StartPoint()' and `EndPoint()' values are the same) and is simple
      (does not pass through the same point more than once).  Returns 0
      if LS is not a ring, and -1 if it is `NULL'.
 
 
Info Catalog (mysql.info.gz) Point property functions (mysql.info.gz) Geometry property functions (mysql.info.gz) Multilinestring property functions
automatically generated byinfo2html