degrees.py

# =========================================================
# calculate the number of feet and meters in degree or
# fraction of a degree arc given the earth's circumference
# ---------------------------------------------------------
# the calculations assume the earth is a perfect sphere
# (the earth is a pear shaped oblate spheroid)
# =========================================================

# -- constants

CIR = 24901.0          # circumference of earth in miles
FML = 5280.0           # feet in a mile
FMT = 3.28084          # feet in a meter
DEG = 360.0            # degrees in a circle

# --- calculate some constants

cf  = CIR * FML        # circumference of earth in feet
cm  = cf / FMT         # circumference of earth in meters
df  = cf / DEG         # one degree of arc in feet
dm  = cm / DEG         # one degree of arc in meters

print('')
print('circumference of earth {} feet'.format(cf))
print('circumference of earth {} meters'.format(cm))
print('One degree of arc      {} feet'.format(df))
print('One meter of arc       {} meters'.format(dm))

# --- probably need to put the following code in a loop so
# --- a user can input degrees and calculate more that once

calcdeg = 0.0010       # degrees to be calculated

ft = df * calcdeg      # feet in calcdeg
mt = dm * calcdeg      # meters in calcdeg

# -- display data

print('')
print('-- Calculating degrees of arc (Earth Circumference) --')
print('   degrees = {}'.format(calcdeg))
print('   feet    = {}'.format(ft))
print('   meters  = {}'.format(mt))