World Borders Dataset
The spatial results tab in SQL Server Management Studio is a useful tool to quickly visualise the geography or geometry data returned by a SELECT query. However, it does not provide any additional context surrounding that data - Points, LineStrings, and Polygons are displayed as abstract shapes against an infinite white background.
When visualising items of geospatial data - data that relates to features on the earth's surface - it is helpful to overlay that data against a background map so that features may be placed in context.
In this post, I'll show you how to create an item representing a simple map of the world that can be used as a background to any results displayed in the SQL Server Management Studio Spatial Results tab. First, download and execute one of the following two queries to create a table containing the background polygons:
![]() Great Britain (geometry datatype, SRID 27700) |
![]() World Borders (geograpy/geometry datatypes, SRID 4326) |
To include the background map in your query, simply add a UNION ALL SELECT to the background shape in your query, as follows:
DECLARE @BermudaTriangle geography SET @BermudaTriangle = geography::STPolyFromText( 'POLYGON((-66.07 18.45, -64.78 32.3, -80.21 25.78, -66.07 18.45))', 4326) SELECT @BermudaTriangle UNION ALL SELECT geog FROM World_Borders




Comments
Post new comment