cspice_recgeo

 Abstract I/O Examples Particulars Required Reading Version Index_Entries
```
```

#### Abstract

```
CSPICE_RECGEO converts rectangular coordinates to geodetic
coordinates.

For important details concerning this module's function, please refer to
the CSPICE routine recgeo_c.

```

#### I/O

```
Given:

rectan   a double precision 3-vector or 3xN array
containing the rectangular coordinates of a
position or set of positions.

re      the scalar, double precision equatorial radius of
the body of interest.

f       the scalar, double precision flattening coefficient
of the body, a dimensionless value defined as:

equatorial_radius - polar_radius
--------------------------------
equatorial_radius

the call:

cspice_recgeo, rectan, re, f, lon, lat, alt

returns:

lon   a double precision scalar or N-vector describing
the geodetic longitude measured in radians.

lat   a double precision scalar or N-vector describing
the geodetic latitude measured in radians.

alt   a double precision scalar or N-vector describing
the altitude above the reference spheroid.

'lon', 'lat', and 'alt' return with the same measure of
vectorization (N) as 'rectan'.

```

#### Examples

```
Any numerical results shown for this example may differ between
platforms as the results depend on the SPICE kernels used as input
and the machine specific arithmetic implementation.

;;
;; Load the standard kernel set.
;;
cspice_furnsh, 'standard.tm'

;;
;; Retrieve the triaxial radii of the earth
;;
cspice_bodvrd, 'EARTH', 'RADII', 3, radii

;;
;; Calculate the flatness coefficient. Set a bodyfixed
;; position.
;;
flat = (radii[0] - radii[2])/radii[0]
x    = [ -2541.748162d, 4780.333036d, 3360.428190d]

cspice_recgeo, x, radii[0], flat, lon, lat, alt

;;
;; Output, convert the angular values to degrees.
;;
print, 'Scalar:'
print, FORMAT='( F12.6,3x, F12.6,3x, F12.8)', lon *cspice_dpr() \$
, lat *cspice_dpr() \$
, alt
print

;;
;; Using the equatorial radius of the Clark66 spheroid
;; (CLARKR = 6378.2064 km) and the Clark 66 flattening
;; factor (CLARKF = 1.0 / 294.9787 ) convert to
;; body fixed rectangular coordinates.
;;
CLARKR = 6378.2064d
CLARKF = 1.d/294.9787d

x = [ [ 0.d,  0.d, 0.d ], \$
[ 1.d,  0.d, 0.d ], \$
[ 0.d,  1.d, 0.d ], \$
[ 0.d,  0.d, 1.d ], \$
[-1.d,  0.d, 0.d ], \$
[ 0.d, -1.d, 0.d ], \$
[ 0.d,  0.d,-1.d ], \$
[ 1.d,  1.d, 0.d ], \$
[ 1.d,  0.d, 1.d ], \$
[ 0.d,  1.d, 1.d ], \$
[ 1.d,  1.d, 1.d ] ]

cspice_recgeo, x, CLARKR, CLARKF, lon, lat, alt

print, 'Vector:'

;;
;; Load the data for easy output.
;;
output      = dblarr(3,11)

;;
;; Convert angular measures to degrees.
;;
output(0,*) = lon * cspice_dpr()
output(1,*) = lat * cspice_dpr()
output(2,*) = alt

print, FORMAT='( F12.6,3x, F12.6,3x, F12.6)', output

IDL outputs:

Scalar:
118.000000      32.000000     0.00000024

118 degrees west, 32 north, .24 mm altitude.

Vector:
0.000000      90.000000   -6356.583800
0.000000      88.677225   -6356.572258
90.000000      88.677225   -6356.572258
0.000000      90.000000   -6355.583800
180.000000      88.677225   -6356.572258
-90.000000      88.677225   -6356.572258
0.000000     -90.000000   -6355.583800
45.000000      88.129144   -6356.560715
0.000000      88.707084   -6355.572518
90.000000      88.707084   -6355.572518
45.000000      88.171393   -6355.561236

```

```
None.

```

```
ICY.REQ

```

#### Version

```
-Icy Version 1.1.2, 29-SEP-2007, EDW (JPL)

Replaced the comment fragment in the I/O section

"return with the same order"

with

"return with the same measure of vectorization"

-Icy Version 1.1.1, 26-MAY-2005, EDW (JPL)

Corrected expression of x vector in example, from

x = [ -2541.748162d, 4780.333036d, 3360.428190]

to

x = [ -2541.748162d, 4780.333036d, 3360.428190d]

Failure to declare the third component double caused an
incorrect evaluation - the correct evaluation
changes the 'alt' value from 0.000018 to 0.00000024.

-Icy Version 1.1.0, 12-SEP-2004, EDW (JPL)

Added capability to process vector 'rectan' as
input returning vectors 'lon', 'lat', and
'alt' on output.

-Icy Version 1.0.0, 16-JUN-2003, EDW (JPL)

```

#### Index_Entries

```
rectangular to geodetic

```
`Wed Apr  5 17:58:03 2017`