Returns a polygonal approximation of a geography instance that contains circular arc segments.
.CurveToLineWithTolerance( tolerance, relative )
tolerance
Is a double expression that defines the maximum error between the original circular arc segment and its linear approximation.
relative
Is a bool expression indicating whether to use a relative maximum for the deviation. When relative is set to false (0), then an absolute maximum is set for the deviation that a linear approximate can have. When relative is set to true (1) then the tolerance is calculated as a product of the tolerance parameter and the diameter of the bounding box for the spatial object.
SQL Server return type: geography
CLR return type: SqlGeography
Setting tolerance <= 0 throws an ArgumentOutOfRange exception.
This method allows for an error tolerance amount to be specified for the resultant LineString.
CurveToLineWithTolerance method will return a LineString instance for a CircularString or CompoundCurve instance and Polygon instance for a CurvePolygon instance.
The following example shows how setting the tolerance affects the LineString
instance returned from a CircularString
instance:
DECLARE @g geography;
SET @g = geography::Parse('CIRCULARSTRING(-122.358 47.653, -122.348 47.649, -122.348 47.658, -122.358 47.658, -122.358 47.653)');
SELECT @g.CurveToLineWithTolerance(0.1,0).STNumPoints(), @g.CurveToLineWithTolerance(0.01, 0).STNumPoints();
The following example shows what is returned from a MultiLineString
instance that only contains one LineString
instance:
DECLARE @g geography;
SET @g = geography::Parse('MULTILINESTRING((-122.358 47.653, -122.348 47.649))');
SELECT @g.CurveToLineWithTolerance(0.1,0).ToString();
The following example shows what is returned from a MultiLineString
instance that contains more than one LineString
instance:
DECLARE @g geography;
SET @g = geography::Parse('MULTILINESTRING((-122.358 47.653, -122.348 47.649),(-123.358 47.653, -123.348 47.649))');
SELECT @g.CurveToLineWithTolerance(0.1,0).ToString();
The following example uses a CurvePolygon
instance to call CurveToLineWithTolerance()
with relative set to true:
DECLARE @g geography = 'CURVEPOLYGON(COMPOUNDCURVE(CIRCULARSTRING(-122.358 47.653, -122.348 47.649, -122.348 47.658), (-122.348 47.658, -122.358 47.658, -122.358 47.653)))';
SELECT @g.CurveToLineWithTolerance(.5,1).ToString();