Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import fileinput
- import time
- import re
- import math
- def convertDegrees(degrees):
- return '%02.0f'%math.modf(degrees)[1]+'%06.3f'%(math.modf(degrees)[0]*60)
- lat=lon=0
- count=0
- for line in sys.stdin:
- strlat, strlon = line.split(",")
- lat+=float(strlat)
- lon+=float(strlon)
- count+=1
- lat/=count
- lon/=count
- sentence="$GPGGA,"+time.strftime("%H%M%S", time.gmtime())+","+convertDegrees(lat)+"N,"+convertDegrees(lon)+"E,1,04,50,0,M,0,M,,*0"
- print sentence
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement