Implemented selection of WGS84 coordinates

This commit is contained in:
Aaron
2014-11-14 17:53:50 +01:00
parent 9eb55427c6
commit a8cf5243cb

25
gsc.py
View File

@@ -274,7 +274,7 @@ class GPRMC(object):
return gprmc return gprmc
if __name__ == "__main__": if __name__ == "__main__":
'''
# Test koordinaten UNI Bern in WGS84 # Test koordinaten UNI Bern in WGS84
# Sexagesimal: Länge 7° 26' 22.50" / Breite 46° 57' 08.66" # Sexagesimal: Länge 7° 26' 22.50" / Breite 46° 57' 08.66"
# Decimal: Länge 7.438808 / Breite 46.951286 # Decimal: Länge 7.438808 / Breite 46.951286
@@ -290,23 +290,30 @@ if __name__ == "__main__":
lv03 = converter.WGS84toLV03(testlat, testlng, 0) lv03 = converter.WGS84toLV03(testlat, testlng, 0)
print lv03 print lv03
''' '''
converter = GPSConverter()
try: try:
Testfile="/home/aaron/GPS_ZUGKRAFTMESSUNG/20140910_Guellen/GPS_Guellen.txt" Testfile="/home/aaron/GPS_ZUGKRAFTMESSUNG/20140910_Guellen/GPS_Guellen.txt"
sentences = csv.reader(open(Testfile, 'r')) sentences = csv.reader(open(Testfile, 'r'))
# for each line in the file # for each line in the file
for line in sentences: for j, line in enumerate(sentences):
# if the line isn't empty and begins with '$GPRMC' # if the line isn't empty and begins with '$GPRMC'
if line and line[0].strip() == '$GPRMC': if line and line[0].strip() == '$GPRMC':
for word in line: print "__________________________\n"
print word print "[Element: %d]" % j
print "_____________________" for i, word in enumerate(line):
#print "[%d]" % i + word
if i == 3:
tmp = float(word)
tmp = tmp / 100
print "lat: %f" % tmp
if i == 5:
tmp = float(word)
tmp = tmp / 100
print "lon: %f" % tmp
except Exception as e: except Exception as e:
print e print e
finally: finally:
print "[DEBUG]: Cleanup done, exiting." print "[DEBUG]: Cleanup done, exiting."
'''