How to Create a Line in a Spatial Type (Geometry or Geography)

August 17th, 2011 - 12:38 pm ET by Charles | Report spam
I have a series of points and I wish to create lines in a geography column
from them. I can see how to create a point by supplying the lat/long
co-ordinates, but there doesn't seem to be an equivalent for creating lines.

Of course, there is

geography::STLineFromText('LINESTRING(0 0, 10 10)', 4326)

for example, but this is quite cumbersome, and in its simplest form requires
literals to be supplied. And anyway, I have my point data in two geography
columns, so intuitively I would expect to be able to write something like

geography::STLineFromPoints(point1, point2, 4326)

Can anyone direct me to an elegant technique for doing this, ideally without
resorting to strings and parsing?

TIA

Charles
email Follow the discussionReplies 2 repliesReplies Make a reply

Replies

#1 Erland Sommarskog
August 17th, 2011 - 05:51 pm ET | Report spam
Charles () writes:
I have a series of points and I wish to create lines in a geography
column from them. I can see how to create a point by supplying the
lat/long co-ordinates, but there doesn't seem to be an equivalent for
creating lines.

Of course, there is

geography::STLineFromText('LINESTRING(0 0, 10 10)', 4326)



I would suggest that you ask here:
http://social.msdn.microsoft.com/Fo...al/threads

The spatial data types is a very specialised subject, and it goes way
over my head.
Erland Sommarskog, SQL Server MVP,

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sql...14207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sql...95970.aspx

Similar topics