SQLGeography in SQL Server 2012 - Polygon must start on correct position?

added by sedanwer
12/1/2012 4:17:28 PM


I've been working with some simple spatial data lately. In one use-case, the user marks a polygon by using an iPad or iPhone in field and walks around storing points (coordinates), which after at least three points, forms an area (the first coordinates are also used as the last to close it). I’m using the built in spatial functionality in SQL Server 2012. According to SqlGeography.STIsValid and SqlGeography.IsValidDetailed, the surface was a valid polygon, but when using e.g SqlGeography.STContains and checking if a point was contained by the polygon, it said yes for one that wasn't, and no for one that was. Lets look why and how to fix it.