Search code examples
pyephem

How to interpret PyEphem lat/long


Tried using PyEphem sample codes below:

import ephem
import datetime
import math

name = "SPOT 6";
line1 = "1 38755U 12047A   15104.74620640  .00000406  00000-0  96954-4 0  9999";
line2 = "2 38755  98.1581 172.5167 0001084  90.6537 269.4779 14.58589040138138";
spot6 = ephem.readtle(name, line1, line2)
spot6.compute('2015/4/15')
print('\nLat:%s, Long:%s' % (spot6.sublat, spot6.sublong))

Lat:-70:19:25.5, Long:126:16:41.2

How to interpret the above lat/long coordinates? If converted to lat/long in degree decimal, what will it be?


Solution

  • You can convert an angle, whose float value is in radians, to degrees by using the degree symbol in PyEphem:

    from ephem import degree
    print(spot6.sublat / degree)
    print(spot6.sublong / degree)
    

    This will print the decimal equivalents to the degree measurements that PyEphem was printing in arcminutes and arcseconds:

    -70.3237369775
    126.278121979