The CircularString Geometry in SQL Server 11 (Denali)

SQL Server Denali supports several new types of spatial geometry, including the CircularString. The CircularString, like the LineString, is an instantiable geometry derived from the abstract curve class. However, unlike the LineString which uses linear interpolation to connect points using straight lines, the paths drawn between the points of a CircularString are circular arcs.

Since there are an infinite number of circular arcs that can be drawn to connect two points, whereas a LineString can consist of only two points, a CircularString must contain at least 3 points – a start point, end point, and an “anchor” point that lies somewhere on the circular arc between the start and end points.

Here’s an example of the WKT for a basic CircularString:

CIRCULARSTRING(1 5, 6 2, 7 3)

and here’s the Circular String it represents (grey dotted line added just to illustrate the complete circle from which the arc is formed):


Here’s another CircularString between the same start and end points, but this time the anchor point has been placed at (5,5) instead:

CIRCULARSTRING(1 5, 5 5, 7 3)


Each additional segment added to the CircularString requires an additional two points – one end point to determine where the segment ends, and one “anchor” point to determine which circular arc path is used to get there. It is worth noting that to define a complete circle requires 5 points (not 3, as you might expect). This is because three points alone would not be sufficient to specify the orientation of the CircularString – it would be ambiguous as to whether the points should be traversed in clockwise or anti-clockwise order.

Instead you must define a circle as follows:

CIRCULARSTRING(4 1, 7 4, 4 7, 1 4, 4 1)


Compare this to geometry created if the same set of points were defined instead as a LineString:

LINESTRING(4 1, 7 4, 4 7, 1 4, 4 1)


This entry was posted in SQL Server and tagged , . Bookmark the permalink.

7 Responses to The CircularString Geometry in SQL Server 11 (Denali)

  1. Pingback: Tweets that mention The CircularString Geometry in SQL Server 11 (Denali) | Alastair Aitchison --

  2. Jorge says:

    Hi Alistair, very informative post, thank you.

    Do you know if there is any map server supporting this new geometry type? Oracle had arcs for a while so some map servers like deegree support them. I know, I should ask them but maybe you have any idea.

    • alastaira says:

      Hi Jorge – thanks for the comment.
      No, CircularStrings are not that widely supported in many mapping platforms, which generally only support points, linestrings, and polygons (many also don’t support the multielement types either). But SQL Server does have a STCurveToLine() method that can be used to create a linestring that approximates the shape of a circularstring. So you can store your data in the DB as a circularstring, but convert it to a many-segment linestring for display purposes.

  3. Paul Nalos says:

    Thanks very much for this insight. I had thought it was a bug that SQL Server didn’t support three-point closed CircularStrings – but now it seems very well reasoned.

  4. Bob says:

    >I had thought it was a bug that SQL Server didn’t support three-point closed CircularStrings – but now it seems very well reasoned.

    It is… Microsoft try to insert incompatibilities where ever they can, and other developers that try to support them need to follow them around and wipe their ass.

  5. Martin says:

    Any idea why this returns 0?

    SELECT geometry::STGeomFromText(‘CIRCULARSTRING(4 1, 7 4, 4 7, 1 4, 4 1)’, 0 ).STContains(geometry::STPointFromText(‘POINT (4 4)’, 0 ))

    I thought that it would check if the circle contains its centre but obviously not!

    I’m sure I’m missing something entirely basic…

    • alastaira says:

      CircularStrings, just like regular LineStrings, don’t “contain” any area, even when they form a closed shape. You’re probably looking for a CurvePolygon instead.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s