Splitting a polygon using SQL Server Spatial queries
A recent project involved drawing regions on a map of a country using the Bing Maps Silverlight control . The user could zoom in to a suburb and draw a region (polygon) around an area on the map. Another feature, and hence the purpose of this blog post, involved enabling a user to draw a line through a region (polygon) and split the region in two: how was that splitting done? Note: you will probably need some database experience and ideally some Bing/Google Maps experience for this to make sense A quick intro to SQL Server Spatial queries SQL Server 2008 introduced support for geo-spatial data . The two new spatial data types are: Geometry: supports flat data surfaces. The following will create a polygon and a line and you can see that our resulting rectangle and line are straight: DECLARE @Geometry GEOMETRY = 'POLYGON((10 10, 40 10, 40 40, 10 40, 10 10))' DECLARE @Linestring GEOMETRY = 'LINESTRING(5 5, 50 50)' SELECT @Geometry SELECT @Linestr...