Use below script to draw a circle:
DECLARE @Points AS FLOAT ;
DECLARE @count AS INT ;
DECLARE @size AS INT ;
SET @Points = 360;
SET @count = 0;
SET @size = 1;
DECLARE @tmpTable TABLE (
geo geometry);
WHILE (@count < @Points)
BEGIN
INSERT INTO @tmpTable
SELECT geometry::STGeomFromText('POINT(' + CAST (SIN(RADIANS((CAST (@count AS FLOAT) / CAST (@Points AS FLOAT)) * @Points)) * @size AS VARCHAR) + ' ' + CAST (COS(RADIANS((CAST (@count AS FLOAT) / CAST (@Points AS FLOAT)) * @Points)) * @size AS VARCHAR) + ')', 4326) AS Posn;
SET @count = @count + 1;
END
SELECT geo
FROM @tmpTable;
Now choose the 'Spatial Results' tab:
DECLARE @Points AS FLOAT ;
DECLARE @count AS INT ;
DECLARE @size AS INT ;
SET @Points = 360;
SET @count = 0;
SET @size = 1;
DECLARE @tmpTable TABLE (
geo geometry);
WHILE (@count < @Points)
BEGIN
INSERT INTO @tmpTable
SELECT geometry::STGeomFromText('POINT(' + CAST (SIN(RADIANS((CAST (@count AS FLOAT) / CAST (@Points AS FLOAT)) * @Points)) * @size AS VARCHAR) + ' ' + CAST (COS(RADIANS((CAST (@count AS FLOAT) / CAST (@Points AS FLOAT)) * @Points)) * @size AS VARCHAR) + ')', 4326) AS Posn;
SET @count = @count + 1;
END
SELECT geo
FROM @tmpTable;
Now choose the 'Spatial Results' tab:
No comments:
Post a Comment