| title | CurveToLineWithTolerance (geography Data Type) | ||
|---|---|---|---|
| description | CurveToLineWithTolerance (geography Data Type) | ||
| author | MladjoA | ||
| ms.author | mlandzic | ||
| ms.date | 03/14/2017 | ||
| ms.service | sql | ||
| ms.subservice | t-sql | ||
| ms.topic | reference | ||
| ms.custom |
|
||
| f1_keywords |
|
||
| helpviewer_keywords |
|
||
| dev_langs |
|
||
| monikerRange | =azuresqldb-current || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-mi-current || =fabric-sqldb |
[!INCLUDE SQL Server Azure SQL Database Azure SQL Managed Instance FabricSQLDB]
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 that indicates whether to use a relative maximum for the deviation. If relative is false (0), then an absolute maximum is set for the deviation that a linear approximate can have. When relative is true (1), then the tolerance is calculated as a product of the tolerance parameter and the bounding box's diameter for the spatial object.
[!INCLUDEssNoVersion] 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();