Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

BufferWithTolerance (geometry Data Type)

Returns a geometric object that represents the union of all point values whose distance from a geometry instance is less than or equal to a specified value, allowing for a specified tolerance.

.BufferWithTolerance ( distance, tolerance, relative )
distance

Is a float expression specifying the distance from the geometry instance around which to calculate the buffer.

tolerance

Is a float expression specifying the tolerance of the buffer distance.

Tolerance refers to the maximum variation in the ideal buffer distance for the returned linear approximation.

For example, the ideal buffer distance of a point is a circle, but this must be approximated by a polygon. The smaller the tolerance, the more points the polygon will have, which increases the complexity of the result, but decreases the error.

relative

Is a bit specifying whether the tolerance value is relative or absolute. If 'TRUE' or 1, then tolerance is relative and is calculated as the product of the tolerance parameter and the diameter of the bounding box of the instance. If 'FALSE' or 0, tolerance is absolute and the tolerance value is the absolute maximum variation in the ideal buffer distance for the returned linear approximation.

SQL Server return type: geometry

CLR return type: SqlGeometry

The tolerance parameter must be greater than zero. If tolerance <= 0 then a System.ArgumentOutOfRangeException is thrown.

Note Note

Since tolerance is a float type, a System.Runtime.InteropServices.COMException can be thrown if the value given for tolerance is very small because of the rounding issues with floating point types.

When distance > 0 then either a Polygon or MultiPolygon instance is returned.

Note Note

Since distance is a float, an extremely small value can equate to zero in the calculations. When this occurs, a copy of the calling geometry instance is returned. See float and real (Transact-SQL).

When distance = 0 then a copy of the calling geometry instance is returned.

When distance < 0 then

  • An empty GeometryCollection instance is returned when the dimensions of the instance are 0 or 1.

  • A negative buffer is returned when the dimensions of the instance are 2 or more.

    Note Note

    A negative buffer may also create an empty GeometryCollection instance.

A negative buffer removes all points within the given distance of the boundary of the geometry instance.

The error between the theorectical and computed buffer is max(tolerance, extents * 1.E-7) where tolerance is the value of the tolerance parameter. For more information on extents, see geometry Data Type Method Reference.

The following example creates a Point instance and uses BufferWithTolerance() to obtain a rough buffer around it.

DECLARE @g geometry;
SET @g = geometry::STGeomFromText('POINT(3 3)', 0);
SELECT @g.BufferWithTolerance(1, .5, 0).ToString();
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.