There are three new geospatial features in Microsoft SQL Server 2012: CircularString, CurvePolygon, and CompoundCurve. For the fun and as an example, I will test CompoundCurve, a set of circular strings that may be combined with line strings, and store a “dbi” character set in a table.:-D
What is CompoundCurve?
It’s a set of circular strings, or circular strings combined with line strings, that form a desired curved shape. The end point of each element in the collection must match the starting point of the following element, so that compound curves are defined in a “connect-the-dots” fashion.
To be valid it must meet the following criteria:
- It must contain at least one CircularString or LineString instance
- The sequence of CircularString or LineString instances must be continuous
- See msdn definition
Creating a table to store the “dbi” character set
We have to create a simple geometry column table to store the “dbi” character set:
Creating the “d”
The first step is to create the “d” from dbi. The “d” character is made of an arc and a line.
An arc is defined with the command CircularString. For more information on CircularString, go to msdn reference
Let’s define 3 points for the “d” arc:
The second is the line and I use the command LineString. For more information about LineString, go to msdn reference.
Let’s define 2 points for the “d” line:
To create the “d”, you have to add the 2 previous geometries with a STUnion option.
For more information about STUnion, go to msdn reference.
This is a classical way to create a “d”, but in SQL server 2012, you can can use the CompoundCurve feature for this.
CompoundCurve is the combination of the features CircularString and LineString.
Notice that you don’t need to use the LineString command, it’s implied.
Creating the “b”
On the same principle, let’s create the “b” from dbi.
Creating the “i”
For the “i”, you needa simple point and the command LineString.
Insert the “dbi” character set in the table
Now that you have created all geometries for the character set, you can concat all geometries with the STUnion feature and insert them in the table.
It’s very easy to use the CompoundCurve features and it’s funny to play with geometrical features.😀