SQL Server 2008 Books Online (October 2009)
LineString

A LineString is a one-dimensional object representing a sequence of points and the line segments connecting them. A LineString instance must be formed of at least two distinct points, and can also be empty.

Examples

The illustration below shows examples of LineString instances.

Examples of geometry LineString instances

As shown in the illustration:

  • Figure 1 is a simple, nonclosed LineString instance.
  • Figure 2 is a nonsimple, nonclosed LineString instance.
  • Figure 3 is a closed, simple LineString instance, and therefore is a ring.
  • Figure 4 is a closed, nonsimple LineString instance, and therefore is not a ring.
Examples

The following example shows how to create a geometry LineString instance with three points and an SRID of 0:

DECLARE @g geometry;
SET @g = geometry::STGeomFromText('LINESTRING(1 1, 2 4, 3 9)', 0);

Each point in the LineString instance may contain Z (elevation) and M (measure) values. This example adds M values to the LineString instance created in the example above. M and Z can be null values.

DECLARE @g geometry;
SET @g = geometry::STGeomFromText('LINESTRING(1 1 NULL 0, 2 4 NULL 12.3, 3 9 NULL 24.5)', 0);
See Also

Concepts

Designing and Implementing Spatial Storage (Database Engine)

Other Resources

STLength (geometry Data Type)
STStartPoint (geometry Data Type)
STEndpoint (geometry Data Type)
STPointN (geometry Data Type)
STNumPoints (geometry Data Type)
STIsRing (geometry Data Type)
STIsClosed (geometry Data Type)
STPointOnSurface (geometry Data Type)

Help and Information

Getting SQL Server 2008 Assistance
Tags :


Page view tracker