-1

In SQL Server 2012 a polygon is consists of an exterior ring with zero or some interior rings. So every simple polygon (rectangle, square and ...) must have an exterior ring and

From MSDN:

The following criteria are needed for a ring to be acceptable.

  • The LineString instance must be accepted.
  • The LineString instance must have at least four points.
  • The starting and ending points of the LineString instance must be the same.

So what if I want to declare a triangle with three points in SQL Server 2012?

Community
  • 1
  • 1
Hossein Narimani Rad
  • 31,361
  • 18
  • 86
  • 116

1 Answers1

3

From Microsoft: http://msdn.microsoft.com/en-us/library/bb895267.aspx

DECLARE @g geometry;
SET @g = geometry::STPolyFromText('POLYGON((100 100, 200 200, 300 100, 100 100))', 0);
SELECT @g.ToString();

It has 3 points and then returns to its starting point (100,100). You can see the area returns 10000, which is consistent with a triangle of base 200 and height 100:

SELECT @g.STArea();
Kevin Suchlicki
  • 3,096
  • 2
  • 15
  • 17