Sunday, November 23, 2008

SQL Server 2008 – Spatial Data in 3D

Last week I attended an MSDN event in downtown Denver where one of the technologies demonstrated was SQL Server 2008. SQL Server 2008 supports spatial data and all the demos showed only data in 2 dimensions (X,Y).

I was wondering if SQL Server 2008 supported 3 dimensional data (X,Y,Z) and came across this post/tutorial and it does!

http://blogs.msdn.com/davidlean/archive/2008/11/01/sql-2008-spatial-samples-part-2-of-n-background-on-spatial-types-well-known-text-wkt.aspx

Summary:

The .AsTextZM()  and .ToString() can be used on a spatial datatype to get the X,Y,Z (and M) values of a geometry.

On the other hand, .STAsText() returns only the X,Y values of a geometry.

 

And to create geometries you use a function like: STMPolyFromText

geometry::STMPolyFromText('MULTIPOLYGON (((5 5, 10 5, 10 10, 5 5)), ((10 10, 100 10, 200 200, 30 30, 10 10)))', 0);

 

To find out how to construct various geomteries in WKT, see http://edndoc.esri.com/arcsde/9.1/general_topics/wkt_representation.htm

No comments:

Post a Comment

Remember, if you want me to respond to your comment, then you need to use a Google/OpenID account to leave the comment.