Similar to spherical polygons, you can use the aggregate function
spath( | edge) ; |
spoint edge
;
to create a spherical path using a set of spherical points.
There are the same restrictions as with the input function of
spherical path (see Section 3.7). The function returns
NULL
if the path couldn't be created.
Example 4.8. Create a spherical path using a set of spherical points
Create a table and put in some spherical points with a unique ID. Then, create a spherical path from it.
sql> SELECT set_sphere_output('DEG'); set_sphere_output ------------------- SET DEG (1 row) sql> CREATE TABLE points ( i int PRIMARY KEY, p spoint ); sql> INSERT INTO points VALUES (1, '( 0d, 10d)'); sql> INSERT INTO points VALUES (2, '( 0d, 0d)'); sql> INSERT INTO points VALUES (3, '( 0d,-10d)'); sql> SELECT spath(data.p) FROM ( SELECT p FROM points ORDER BY i ASC ) AS data ; spath --------------------------------------------------- {(0d , 10d),(0d , 0d),(0d , -10d)} (1 row) sql> SELECT spath(data.p) FROM ( SELECT p FROM points ORDER BY i DESC ) AS data ; spath --------------------------------------------------- {(0d , -10d),(0d , 0d),(0d , 10d)} (1 row)