5.5. Distance
Prev | Up | Chapter 5. Operators | Home | Next

## 5.5. Distance #

The binary distance operator `<->` is a non-boolean operator returning the distance between two objects in radians. Currently, pgSphere supports only distances between points, circles, between point and circle, and between point and line. If the objects are overlapping, the distance operator returns zero (0.0).

Example 5.9. Distance between two circles

    sql> SELECT 180 * ( scircle '<(0d,20d),2d>' <-> scircle '<(0d,40d),2d>' )
            / pi() AS dist ;
     dist
    ------
     16
    (1 row)

Example 5.10. Distance between point and line

    sql> SELECT 180 * (sline '( 0d, 0d, 0d, XYZ ), 40d ' <-> spoint '( 0d, 90d )')
            / pi() AS dist ;
     dist
    ------
     90
    (1 row)

Prev | Up | Next
5.4. Crossing of lines | Home | 5.6. Length and circumference