Last active
November 10, 2018 20:15
-
-
Save KMarkert/2fdbe1845ecc9897271c8c620faeb06d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
def dd2dms(dd): | |
if dd < 0: | |
degrees = math.ceil(dd) | |
else: | |
degrees = math.floor(dd) | |
minutes = 60 * (dd%1) | |
seconds = 60 * (minutes%1) | |
return {'degrees':degrees,'minutes':math.floor(minutes),'seconds':seconds} | |
def dms2dd(degrees,minutes,seconds): | |
secDeci = '{}'.format((seconds/60)/100) | |
minDeci = '{}'.format(minutes/60) | |
dd = degrees + float(minDeci) + float(secDeci) | |
return {'decimal degrees': dd} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment