5.6.  Length and circumference #

The length/circumference operator @-@ is a non-boolean unary operator returning the circumference or length of an object. In the current implementation, pgSphere supports only circumferences of circles, polygons, and boxes. It supports lengths of lines and paths too. Instead of using the operator, you can use the functions circum(object) or length(object).

Example 5.11. Circumference of a circle

sql> SELECT 180 * ( @-@ scircle '<(0d,20d),30d>' )/ pi() AS circ ;
 circ
------
 180
(1 row)
              

Example 5.12. Length of a line

sql> SELECT 180 * ( @-@ sline '(0d,0d,0d),30d' )/ pi() AS length ;
 length
--------
 30
(1 row)