NEW SPATIAL FEATURES IN The SQL SERVER 2008 FEBRUARY CTP

Now that the February CTP (CTP-6) for SQL Server 2008 is available, it's time to let folks know what new spatial features have been added or updated since the November CTP (CTP-5).

Before I get into the new and updated features, I want to make sure that it is clear that the latitude-longitude coordinate ordering switch, which we will be making for the Geography type, is not in CTP-6. Please see https://blogs.msdn.com/isaac/archive/2007/12/27/latitude-longitude-ordering.aspx for more information

Here are the new and updated features:

Degenerate Polygons are now collapsed to LineStrings or Points instead of to Empty. Previously, if you had a Polygon with a very thin spike and ran an operation on it, there was a good chance that the spike would disappear entirely. Additionally, in some cases, STIntersects between two Polygons would return 1, however the STIntersection would return GeometryCollection Empty because the resultant intersection was considered to be a degenerate Polygon. Another example of this behavior is seen in the following post: https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2709103&SiteID=1 where a small buffer on a large LineString produced a MultiPolygon which looked like a dashed-line as portions of the resultant very thin Polygon were considered degenerate and collapsed to empty. In CTP-6, this will return a GeometryCollection with LineString segments connecting all of the original MultiPolygon segments together.

Reduce (Douglas-Peucker -based Generalization). Because of the above change, we were able to remove the exception that would occur when you ran Reduce on a Geometry that would produce an invalid output. Instead, we call MakeValid on the result, which, although it may alter the type or structure of the original Geometry, will not collapse it to Empty. For example, in CTP-5 the call:

SELECT geometry::Parse('POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0))').Reduce(10).ToString()

would throw an exception saying that the method could not be completed because the result would be Invalid. In CTP-6, it will return:

LINESTRING(10 10, 0 0)

In addition, the Reduce method was added to the Geography type. Given a tolerance in the units of the SRID defining the Geography, Reduce will apply the Douglas-Peucker algorithm to return a simplified version of the Geography data. Since the Reduce method is intended for scenarios where speed and simplicity is more important than accuracy, determining if a vertex is within tolerance to the line will not be computed by using the precise geodetic distance. Instead, the distance will be computed as the great circle distance on the sphere defined by the average of the ellipsoid's semi-major and semi-minor radii. While this is less accurate, it is significantly faster to compute.

Filter. Filter is a new method added to both types that provides a fast index-only intersects method that may produce false-positives (a.k.a. a primary filter). It does this by returning all objects in the cells of the index which contain the parameter object, without running the full spatial STIntersects test to determine whether they actually intersect. If no index is defined on the table or the index is not used in the query or the method is used on the client directly, then the method behavior maps exactly to that of STIntersects. This method is useful for scenarios where it is important to quickly determine whether there are any candidate intersections, or to quickly return the candidate objects to a specialized client, such as a graphics canvas, which does not care if there is a true intersection at the edges of the display.

EnvelopeCenter and EnvelopeAngle (Geography data type). The methods EnvelopeCenter and EnvelopeAngle were added to the Geography type. These two methods allow users to fetch a simple description for the bounds of a geodetic object. The corresponding operation (STEnvelope) on Geometry does not make sense on the earth, as it returns a bounding box with straight lines that cannot be represented on the ellipsoid. We instead return a bounding circle, which is not guaranteed to be the minimal possible bounding circle. This is the same bounding circle we use to determine if a Geography fits inside a hemisphere.

EnvelopeCenter() : Returns the point described by the vector sum of the points in the Geography. For closed loops, either in a Polygon or a LineString, the duplicate first/last point is used only once. This point will not correspond to the true Centroid of the Geography.

EnvelopeAngle() : Returns the maximum angle between the point returned by EnvelopeCenter and a point in the Geography in degrees. The maximum value for this method is 90, as otherwise the Geography would be considered to exceed a hemisphere.

STDistance (GEOGRAPHY data type). In CTP-5, STDistance could only be calculated on Geography instances if one of the inputs was a Point object. This restriction has now been removed, and STDistance can be calculated on any pair of Geography objects.

We will have a few more changes to Spatial coming in the next CTP (including the aforementioned latitude-longitude coordinate order switch). These changes will be discussed when we are closer to release.