กิจกรรม
31 มี.ค. 23 - 2 เม.ย. 23
อิเกีย เหตุการณ์การเรียนรู้ SQL, Fabric และ Power BI ที่ใหญ่ที่สุด 31 มีนาคม – 2 เมษายน ใช้รหัส FABINSIDER เพื่อบันทึก $400
ลงทะเบียนวันนี้เบราว์เซอร์นี้ไม่ได้รับการสนับสนุนอีกต่อไป
อัปเกรดเป็น Microsoft Edge เพื่อใช้ประโยชน์จากคุณลักษณะล่าสุด เช่น การอัปเดตความปลอดภัยและการสนับสนุนด้านเทคนิค
Applies to:
SQL Server
Azure SQL Database
Azure SQL Managed Instance
SQL analytics endpoint in Microsoft Fabric
Warehouse in Microsoft Fabric
SQL database in Microsoft Fabric
A CircularString is a collection of zero or more continuous circular arc segments. A circular arc segment is a curved segment defined by three points in a two-dimensional plane; the first point cannot be the same as the third point. If all three points of a circular arc segment are collinear, the arc segment is treated as a line segment.
The drawing below shows valid CircularString instances:
A CircularString instance is accepted if it is either empty or contains an odd number of points, n, where n > 1. The following CircularString instances are accepted.
DECLARE @g1 geometry = 'CIRCULARSTRING EMPTY';
DECLARE @g2 geometry = 'CIRCULARSTRING(1 1, 2 0, -1 1)';
DECLARE @g3 geometry = 'CIRCULARSTRING(1 1, 2 0, 2 0, 2 0, 1 1)';
@g3
shows that CircularString instance might be accepted, but not valid. The following CircularString instance declaration is not accepted. This declaration throws a System.FormatException
.
DECLARE @g geometry = 'CIRCULARSTRING(1 1, 2 0, 2 0, 1 1)';
A valid CircularString instance must be empty or have the following attributes:
The following example shows valid CircularString instances.
DECLARE @g1 geometry = 'CIRCULARSTRING EMPTY';
DECLARE @g2 geometry = 'CIRCULARSTRING(1 1, 2 0, -1 1)';
DECLARE @g3 geometry = 'CIRCULARSTRING(1 1, 2 0, 2 0, 1 1, 0 1)';
DECLARE @g4 geometry = 'CIRCULARSTRING(1 1, 2 2, 2 2)';
SELECT @g1.STIsValid(), @g2.STIsValid(), @g3.STIsValid(),@g4.STIsValid();
A CircularString instance must contain at least two circular arc segments to define a complete circle. A CircularString instance cannot use a single circular arc segment (such as (1 1, 3 1, 1 1)) to define a complete circle. Use (1 1, 2 2, 3 1, 2 0, 1 1) to define the circle.
The following example shows CircularString instances that are not valid.
DECLARE @g1 geometry = 'CIRCULARSTRING(1 1, 2 0, 1 1)';
DECLARE @g2 geometry = 'CIRCULARSTRING(0 0, 0 0, 0 0)';
SELECT @g1.STIsValid(), @g2.STIsValid();
In the following cases a circular arc segment will be treated as a line segment:
This example shows how to create an empty CircularString instance:
DECLARE @g geometry;
SET @g = geometry::Parse('CIRCULARSTRING EMPTY');
The following example shows how to create a CircularString instance with a single circular arc segment (half-circle):
DECLARE @g geometry;
SET @g = geometry:: STGeomFromText('CIRCULARSTRING(2 0, 1 1, 0 0)', 0);
SELECT @g.ToString();
The following example shows how to create a CircularString instance with more than one circular arc segment (full circle):
DECLARE @g geometry;
SET @g = geometry::Parse('CIRCULARSTRING(2 1, 1 2, 0 1, 1 0, 2 1)');
SELECT 'Circumference = ' + CAST(@g.STLength() AS NVARCHAR(10));
Here's the result set.
Circumference = 6.28319
Compare the output when LineString is used instead of CircularString:
DECLARE @g geometry;
SET @g = geometry::STGeomFromText('LINESTRING(2 1, 1 2, 0 1, 1 0, 2 1)', 0);
SELECT 'Perimeter = ' + CAST(@g.STLength() AS NVARCHAR(10));
Here's the result set.
Perimeter = 5.65685
The value for the CircularString example is close to 2∏, which is the actual circumference of the circle.
This snippet shows how to declare and instantiate a geometry instance with a CircularString in the same statement:
DECLARE @g geometry = 'CIRCULARSTRING(0 0, 1 2.1082, 3 6.3246, 0 7, -3 6.3246, -1 2.1082, 0 0)';
The following example shows how to declare and instantiate a geography instance with a CircularString:
DECLARE @g geography = 'CIRCULARSTRING(-122.358 47.653, -122.348 47.649, -122.348 47.658, -122.358 47.658, -122.358 47.653)';
The following example shows how to create a CircularString instance that is a straight line:
DECLARE @g geometry;
SET @g = geometry::STGeomFromText('CIRCULARSTRING(0 0, 1 2, 2 4)', 0);
กิจกรรม
31 มี.ค. 23 - 2 เม.ย. 23
อิเกีย เหตุการณ์การเรียนรู้ SQL, Fabric และ Power BI ที่ใหญ่ที่สุด 31 มีนาคม – 2 เมษายน ใช้รหัส FABINSIDER เพื่อบันทึก $400
ลงทะเบียนวันนี้