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.
The illustration below shows examples of 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.
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);
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