User's Guide and Reference

Linestrings

A linestring is a one-dimensional object stored as a sequence of points defining a linear interpolated path. The linestring is simple if it does not intersect its interior. The endpoints (the boundary) of a closed linestring occupy the same point in space. A linestring is a ring if it is closed and if its interior does not intersect itself. In addition to the other properties inherited from the superclass geometry, linestrings have length. Linestrings are often used to define linear features such as roads, rivers, and power lines.

A simple linestring whose startpoint and endpoint are the same is called a ring.

The endpoints normally form the boundary of a linestring unless the linestring is closed in which case the boundary is NULL. The interior of a linestring is the connected path that lies between the endpoints, unless it is closed in which case the interior is continuous.

Functions that operate on linestrings:

ST_StartPoint
Takes a linestring and returns its first point. For more information, see ST_StartPoint.

ST_EndPoint
Takes a linestring and returns its last point. For more information, see ST_Endpoint.

ST_PointN
Takes a linestring and an index to nth point and returns that point. For more information, see ST_PointN.

ST_Length
Takes a linestring and returns its length as a double precision number. For more information, see ST_Length.

ST_NumPoints
Takes a linestring and returns the number of points in its sequence as an integer. For more information, see ST_NumPoints.

ST_IsRing
Takes a linestring and returns 1 (TRUE) if the linestring is a ring and 0 (FALSE) otherwise. For more information, see ST_IsRing.

ST_IsClosed
Takes a linestring and returns 1 (TRUE) if the linestring is closed and 0 (FALSE) otherwise. For more information, see ST_IsClosed.

Figure 10. Linestring objects.

  1. A simple non-closed linestring.
  2. A non-simple non-closed linestring.
  3. A closed simple linestring and therefore a ring.
  4. A closed non-simple linestring. It is not a ring.



[Figure]


[ Top of Page | Previous Page | Next Page ]