-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathST_ArchimedianSpiralСlockwiseEast
More file actions
23 lines (21 loc) · 828 Bytes
/
Copy pathST_ArchimedianSpiralСlockwiseEast
File metadata and controls
23 lines (21 loc) · 828 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
DROP FUNCTION IF EXISTS ST_ArchimedianSpiralСlockwiseEast(
centerX double precision,
centerY double precision,
radius float,
circleSegs integer,
rings numeric)
CREATE OR REPLACE FUNCTION ST_ArchimedianSpiralСlockwiseEast(
centerX double precision,
centerY double precision,
radius float,
circleSegs integer,
rings numeric)
RETURNS GEOMETRY AS
$BODY$
WITH
spiralStep AS (SELECT i FROM generate_series(0, rings * circleSegs) t(i))
(SELECT ST_MakeLine(ST_MakePoint(centerX + (radius/circleSegs) * i * cos(i * (2 * pi()/circleSegs)),
centerY + (radius/circleSegs) * i * -sin(i * (2 * pi()/circleSegs)))) AS geom FROM spiralStep);
$BODY$
LANGUAGE SQL
SELECT ST_SetSrid(ST_ArchimedianSpiralСlockwiseEast(15.326975287, 37.007075212, 0.003, 75, 3.3), 4326) geom