spoint
functions
#The functions
long( | p) ; |
spoint p
;lat( | p) ; |
spoint p
;
returns the longitude or latitude value of a
spherical position p
in radians.
Example 6.2. Get the longitude and latitude of a spherical point in degrees
sql> SELECT long ( spoint '(10d,20d)' ) * 180.0 / pi() AS longitude; longitude ------------ 10 (1 row) sql> SELECT lat ( spoint '(10d,20d)' ) * 180.0 / pi() AS latitude; latitude ---------- 20 (1 row)
The functions
x( | p) ; |
spoint p
;y( | p) ; |
spoint p
;z( | p) ; |
spoint p
;
return the Cartesian
x
, y
or
z
value of a spherical position
p
. The returned values are always
between -1.0
and +1.0
.
Example 6.3.
Get the Cartesian z
-value
of a spherical point
sql> SELECT z ( spoint '(10d,-90d)' ) AS z; z ---- -1 (1 row)
You can get a float8
array of Cartesian values using the function
xyz( | p) ; |
spoint p
;Example 6.4. Get the Cartesian values of a spherical point
sql> SELECT xyz ( spoint '(0d,0d)' ) AS cart; cart --------- {1,0,0} (1 row)