SQL Server Spatial Viewer – Learning Spatial Stuff – a good place to begin…

Hi Friends,

I often get this question; “I want to learn Spatial, where do I start?” or something similar. Not long ago, I had the same question.

SQL Server Spatial Viewer, Spatial Data, Spatial applications & systems is a specialized field, a different genre altogether. SQL DBAs & DEVs will find it very amusing & interesting to work with Spatial Data, but you may know, it’s serious business out there. All the GPS, GIS stuff; most of it that you see every day, is based on Spatial Data. But the question remains, what the heck it is? And where do I start.

I will point you the some posts that I have written that can help you get started. You can visit many online resources like blogs, etc, or just get a book. Apart from all that, I will suggest you to visit Wiki & http://www.opengeospatial.org/ (OGC) to get some introductions. Post that you can download a tool called Spatial Viewer from codeplex.com

This tool will help you to get started with learning basic spatial shapes and standards as per OGC. You can also perform basic operations on Spatial shapes like union and intersection.

After you download & install the tool, just start it and you are ready to play with spatial data. For example, in the following diagram, I have drawn a Polygon. While I draw the Polygon, you can see the coordinates on the right side.


You can select the coordinates on the right side (just click on it) and you get the T-SQL in a bottom pane (as shown below).


You can copy that SQL code and paste it in a new query window in SSMS and execute it. Note that I have put a select statement to output the content of the local variable and you have Spatial results tab that gets displayed (whenever there is spatial data in the result set).



I just wanted to introduce you to the tool. There’s  a lot you can do with this tool. For example, draw 2 polygons, overlapping each other with some percentage, select both of them from the right pane, while holding the CTRL key, right click and explore the spatial operations that can be applied on the shapes. See below:


I leave the rest to you to explore.

And yes, here are the links to my earlier posts related to Spatial stuff in SQL Server:









About Amit Bansal

Amit Bansal is always brainstorming around SQL Server. Despite working with SQL since 1997, he is amazed that he keeps learning new things every single day. SQL Server is AB's first love, and his wife does not mind that. He tries to share as much and spreads the SQL goodness. Internals and Performance Tuning excites him, and also gives him sleepless nights at times, simply because he is not a genius, but quite a hard worker and does not give up. It has been a long and exciting journey since 1997, you can read here: http://sqlmaestros.com/amit-bansal/ He is on Twitter: https://www.twitter.com/A_Bansal

View all posts by Amit Bansal →

One Comment on “SQL Server Spatial Viewer – Learning Spatial Stuff – a good place to begin…”

Leave a Reply

Your email address will not be published.