Beginner with python - need a little help

kml file program for google earth linux

Page 1 of 1

6 Replies - 2054 Views - Last Post: 14 September 2010 - 11:14 AM Rate Topic: -----

#1 vwyodapink   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 141
  • Joined: 12-May 09

Beginner with python - need a little help

Posted 13 September 2010 - 04:08 PM

This is one of my first real python programs and I seem to have gotten myself a little lost with this as to what I am doing wrong and everything I keep trying is either not getting me further or adding more issues. What I am trying to do here is have a python program that reads the serial stream coming from /dev/ttyUSB0 turn that into a kml file for google earth and this file will be read by the network connection feature in google earth. I have that kml written as well. The stream coming from the serial is a custom stream and I am trying to break it down accordingly to display right on GE. I still can not get it to read the stream and produce the kml for GE to read and display the info live. This is not school or homework related :P I am sure there is some basic thing I am missing or did not do properly and would really appriciate any and all help and pointers to get this working. I have tried to supply everything I could think of and please feel free to ask me anything else I forgot to state. The OS this is running on is Ubuntu 10.04 if that matters as well. I believe its just the python portion that is faulty but have not been able to test the network link as of yet, Thanks !!

The python program I still cant get to work:
serialToKML.py
#!/usr/bin/python


import serial
import string
import sys
import getopt

def usage():
		print "Usage:"
		print " -p | --port <device>   e.g. /dev/ttyUSB0"
		print " -b | --baud <speed>    e.g. 57600"
		print " -f | --file <filename> e.g. ~/log.kml"
		print " -h | --help     display options"

def main():
	# defaults
	serial_port = "/dev/ttyUSB0"
	serial_baud = 57600
	file = '~/vdubhack/ardulog.kml'

	try:
		opts, args = getopt.getopt(sys.argv[1:], "p:b:f:h", ["port=", "baud=", "file=", "help"])
	except getopt.GetoptError:
		usage()
		sys.exit(1)
	else:
		for opt, arg in opts:
			if opt in ("-p", "--port"):
				serial_port = arg
			elif opt in ("-b", "--baud"):
				serial_baud = string.atof(arg)
			elif opt in ("-f", "--file"):
				file = arg
			elif opt in ("-h", "--help"):
				usage()
				sys.exit(0)
			else:
				print "Unknown option"

	gps = serial.Serial(serial_port, serial_baud, timeout=1)

	print "Serving data from %s (%d baud) to %s" % (serial_port, serial_baud, file)


r = '<?xml version="1.0" encoding="UTF-8"?>\n<kml xmlns="http://www.opengis.net/kml/2.2">'

r += '\n<Document>' \

     '\n<name>'+"your flight"+'</name>' \

     '\n<description>''</description>' \

     '\n<Style id ="redline">\n<LineStyle><color>ff0000ff</color><width>4</width>\n</LineStyle>\n<PolyStyle></PolyStyle>\n</Style>' \

     '\n<Placemark>\n<name>your flight</name>\n<description></description>\n<styleUrl>#redline</styleUrl>\n<LineString><extrude>0</extrude>\n<tessellate>0</tessellate>\n<altitudeMode>relativeToGround</altitudeMode>\n<coordinates>'



def replace_all(text, dic):

  for i, j in dic.iteritems():

    text = text.replace(i, j)

  return text



reps = {':':'', '!':'', 'L':'', 'A':'', 'T':'', 'O':'', 'N':'', 'S':'', 'P':'', 'D':'', 'C':'', 'R':'', 'T':'', 'A':'', 'H':'', 'B':'', 'E':'', 'W':'', 'P':'', 'N':'', 'D':'', 'V':'', '*':''}


b = file

for x in b:

 if x.startswith('!!!'):

  x = replace_all(x, reps)

  x = x.split(',')

  lat = x[0]

  lat = lat[:2] + '.' + lat[2:]

  long = x[1]

  long = long[:4] + '.' + long[4:]

  speed = x[2]

  crt = x[3]

  altitude = x[4]

  alh = x[5]

  crs = x[6]

  bearing = x[7]

  waypoint = x[8]

  distance = x[9]

  batt_volt = x[10]

  rsp = x[11]




f=open(file, 'w')
f.write(output)
f.close()

ser.close()

if __name__ == "__main__":
	main()



Here is the GE kml file I made for the network link:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.1">
<NetworkLink>
	<name>GPS</name>
	<flyToView>1</flyToView>
	<Url>
		<href>~/vdubhack/ardulog.kml</href>
		<refreshMode>onInterval</refreshMode>
		<refreshInterval>1</refreshInterval>
	</Url>
</NetworkLink>
</kml>



And in case this would help here is a sample of the serial stream thats coming in:
+++ASP:-1,THH:1,RLL:-60,PCH:-9,***
+++ASP:0,THH:0,RLL:-60,PCH:-10,***
!!!LAT:32259464,LON:-110823520,SPD:13.58,CRT:0.00,ALT:81,ALH:50,CRS:70.13,BER:330,WPN:0,DST:176,BTV:0.00,RSP:-35,***
+++ASP:1,THH:0,RLL:-60,PCH:-11,***
+++ASP:7,THH:0,RLL:-60,PCH:-12,***
+++ASP:8,THH:0,RLL:-60,PCH:-15,***
+++ASP:7,THH:0,RLL:-60,PCH:-18,***
!!!LAT:32259620,LON:-110823408,SPD:16.40,CRT:0.00,ALT:75,ALH:50,CRS:37.78,BER:325,WPN:0,DST:166,BTV:0.00,RSP:-35,***
+++ASP:18,THH:0,RLL:-60,PCH:-16,***
+++ASP:20,THH:0,RLL:-58,PCH:-22,***
+++ASP:18,THH:0,RLL:-60,PCH:-20,***
+++ASP:28,THH:0,RLL:-60,PCH:-18,***
!!!LAT:32259812,LON:-110823448,SPD:17.96,CRT:0.00,ALT:68,ALH:50,CRS:344.19,BER:321,WPN:0,DST:147,BTV:0.00,RSP:-11,***
+++ASP:25,THH:0,RLL:-43,PCH:-21,***
+++ASP:27,THH:0,RLL:-17,PCH:-29,***
+++ASP:30,THH:0,RLL:-3,PCH:-29,***
+++ASP:23,THH:0,RLL:-8,PCH:-27,***
!!!LAT:32259986,LON:-110823656,SPD:18.79,CRT:0.00,ALT:60,ALH:50,CRS:317.39,BER:322,WPN:0,DST:120,BTV:0.00,RSP:2,***
+++ASP:25,THH:0,RLL:-8,PCH:-19,***
+++ASP:23,THH:0,RLL:-16,PCH:-18,***
+++ASP:26,THH:0,RLL:-18,PCH:-18,***
+++ASP:27,THH:0,RLL:-14,PCH:-21,***
!!!LAT:32260128,LON:-110823864,SPD:19.41,CRT:0.00,ALT:57,ALH:50,CRS:310.51,BER:326,WPN:0,DST:96,BTV:0.00,RSP:7,***
+++ASP:19,THH:6,RLL:-25,PCH:-1,***
!!!LAT:32260246,LON:-110824072,SPD:18.08,CRT:0.00,ALT:55,ALH:50,CRS:302.32,BER:333,WPN:0,DST:74,BTV:0.00,RSP:15,***
+++ASP:16,THH:40,RLL:-34,PCH:19,***
+++ASP:16,THH:48,RLL:-41,PCH:24,***
+++ASP:11,THH:26,RLL:-32,PCH:30,***
+++ASP:9,THH:30,RLL:-6,PCH:34,***
+++ASP:9,THH:14,RLL:13,PCH:35,***
+++ASP:2,THH:9,RLL:6,PCH:23,***
+++ASP:4,THH:2,RLL:7,PCH:17,***
+++ASP:-1,THH:6,RLL:10,PCH:11,***
+++ASP:-2,THH:3,RLL:10,PCH:9,***
!!!LAT:32260468,LON:-110824768,SPD:11.78,CRT:0.00,ALT:66,ALH:50,CRS:295.40,BER:36,WPN:0,DST:53,BTV:0.00,RSP:35,***
+++ASP:0,THH:1,RLL:32,PCH:-6,***
+++ASP:1,THH:1,RLL:30,PCH:-6,***
+++ASP:1,THH:0,RLL:26,PCH:-8,***
+++ASP:0,THH:0,RLL:19,PCH:-9,***
!!!LAT:32260548,LON:-110824896,SPD:13.19,CRT:0.00,ALT:64,ALH:50,CRS:303.15,BER:53,WPN:0,DST:55,BTV:0.00,RSP:35,***
+++ASP:2,THH:1,RLL:1,PCH:-6,***
+++ASP:3,THH:0,RLL:0,PCH:-5,***
+++ASP:6,THH:0,RLL:-9,PCH:0,***
+++ASP:2,THH:0,RLL:-21,PCH:3,***
+++ASP:2,THH:0,RLL:-29,PCH:5,***
!!!LAT:32260766,LON:-110825200,SPD:13.50,CRT:0.00,ALT:61,ALH:50,CRS:308.91,BER:82,WPN:0,DST:73,BTV:0.00,RSP:35,***
+++ASP:-4,THH:0,RLL:-56,PCH:7,***
+++ASP:-1,THH:1,RLL:-59,PCH:6,***
+++ASP:-2,THH:3,RLL:-60,PCH:3,***
+++ASP:0,THH:4,RLL:-60,PCH:4,***
!!!LAT:32260814,LON:-110825368,SPD:12.01,CRT:0.00,ALT:60,ALH:50,CRS:289.85,BER:87,WPN:0,DST:89,BTV:0.00,RSP:35,***
+++ASP:-4,THH:7,RLL:-60,PCH:4,***
+++ASP:-1,THH:6,RLL:-60,PCH:2,***
+++ASP:-1,THH:18,RLL:-60,PCH:-1,***
+++ASP:-3,THH:22,RLL:-60,PCH:-2,***
!!!LAT:32260738,LON:-110825520,SPD:11.15,CRT:0.00,ALT:57,ALH:50,CRS:247.85,BER:83,WPN:0,DST:104,BTV:0.00,RSP:-35,***
+++ASP:-1,THH:47,RLL:-60,PCH:-6,***
+++ASP:-1,THH:59,RLL:-60,PCH:-7,***
+++ASP:2,THH:76,RLL:-60,PCH:-9,***
+++ASP:-2,THH:81,RLL:-60,PCH:-11,***
!!!LAT:32260608,LON:-110825536,SPD:12.14,CRT:0.00,ALT:53,ALH:50,CRS:207.07,BER:75,WPN:0,DST:108,BTV:0.00,RSP:-35,***
+++ASP:3,THH:84,RLL:-60,PCH:-10,***
+++ASP:4,THH:84,RLL:-47,PCH:-13,***
+++ASP:8,THH:84,RLL:-17,PCH:-17,***
+++ASP:6,THH:84,RLL:8,PCH:-18,***
!!!LAT:32260482,LON:-110825448,SPD:14.34,CRT:0.00,ALT:49,ALH:50,CRS:148.01,BER:67,WPN:0,DST:104,BTV:0.00,RSP:-35,***
+++ASP:8,THH:84,RLL:28,PCH:-10,***
+++ASP:6,THH:84,RLL:20,PCH:-5,***
+++ASP:6,THH:84,RLL:13,PCH:-6,***
+++ASP:5,THH:84,RLL:11,PCH:-11,***
!!!LAT:32260360,LON:-110825304,SPD:13.91,CRT:0.00,ALT:48,ALH:50,CRS:138.20,BER:56,WPN:0,DST:98,BTV:0.00,RSP:-35,***
+++ASP:8,THH:84,RLL:9,PCH:-12,***
+++ASP:7,THH:84,RLL:4,PCH:-8,***
+++ASP:5,THH:84,RLL:2,PCH:-11,***
+++ASP:1,THH:84,RLL:-13,PCH:-14,***
!!!LAT:32260220,LON:-110825152,SPD:13.91,CRT:0.00,ALT:46,ALH:50,CRS:138.22,BER:44,WPN:0,DST:97,BTV:0.00,RSP:-35,***
+++ASP:6,THH:84,RLL:-30,PCH:-11,***
+++ASP:4,THH:84,RLL:-38,PCH:-7,***
+++ASP:2,THH:84,RLL:-41,PCH:-7,***
!!!LAT:32260120,LON:-110825000,SPD:14.26,CRT:0.00,ALT:46,ALH:50,CRS:129.81,BER:33,WPN:0,DST:97,BTV:0.00,RSP:-35,***
+++ASP:4,THH:84,RLL:-48,PCH:-6,***
+++ASP:3,THH:84,RLL:-51,PCH:-8,***
+++ASP:5,THH:84,RLL:-56,PCH:-8,***
+++ASP:2,THH:84,RLL:-40,PCH:-1,***
!!!LAT:32260074,LON:-110824792,SPD:14.64,CRT:0.00,ALT:46,ALH:50,CRS:110.63,BER:21,WPN:0,DST:92,BTV:0.00,RSP:-35,***
+++ASP:5,THH:84,RLL:27,PCH:-2,***
+++ASP:-1,THH:84,RLL:45,PCH:-2,***
+++ASP:2,THH:84,RLL:60,PCH:-5,***
+++ASP:1,THH:84,RLL:60,PCH:-1,***
!!!LAT:32260066,LON:-110824600,SPD:14.19,CRT:0.00,ALT:47,ALH:50,CRS:97.08,BER:10,WPN:0,DST:88,BTV:0.00,RSP:-35,***
+++ASP:0,THH:84,RLL:52,PCH:-4,***
+++ASP:0,THH:84,RLL:46,PCH:-6,***
+++ASP:3,THH:84,RLL:37,PCH:-6,***
+++ASP:3,THH:84,RLL:27,PCH:-6,***
!!!LAT:32259998,LON:-110824408,SPD:13.57,CRT:0.00,ALT:47,ALH:50,CRS:110.83,BER:359,WPN:0,DST:94,BTV:0.00,RSP:-35,***
+++ASP:2,THH:84,RLL:23,PCH:-2,***
+++ASP:3,THH:84,RLL:27,PCH:-2,***
+++ASP:1,THH:84,RLL:45,PCH:-4,***
+++ASP:2,THH:84,RLL:60,PCH:-7,***
!!!LAT:32259902,LON:-110824256,SPD:13.08,CRT:0.00,ALT:48,ALH:50,CRS:118.53,BER:351,WPN:0,DST:106,BTV:0.00,RSP:-35,***
+++ASP:-2,THH:84,RLL:60,PCH:-10,***
+++ASP:3,THH:84,RLL:60,PCH:-11,***
+++ASP:6,THH:84,RLL:60,PCH:-13,***
+++ASP:4,THH:84,RLL:60,PCH:-15,***
!!!LAT:32259780,LON:-110824168,SPD:12.32,CRT:0.00,ALT:47,ALH:50,CRS:141.34,BER:348,WPN:0,DST:121,BTV:0.02,RSP:-35,***
+++ASP:4,THH:84,RLL:55,PCH:-18,***
+++ASP:5,THH:84,RLL:49,PCH:-19,***
+++ASP:5,THH:84,RLL:43,PCH:-19,***
+++ASP:6,THH:84,RLL:37,PCH:-21,***
!!!LAT:32259606,LON:-110824152,SPD:13.51,CRT:0.00,ALT:42,ALH:50,CRS:171.33,BER:349,WPN:0,DST:140,BTV:0.00,RSP:35,***
+++ASP:8,THH:84,RLL:20,PCH:-17,***
+++ASP:6,THH:84,RLL:5,PCH:-9,***
+++ASP:8,THH:84,RLL:1,PCH:-6,***
+++ASP:7,THH:84,RLL:-4,PCH:-2,***
!!!LAT:32259446,LON:-110824200,SPD:13.76,CRT:0.00,ALT:40,ALH:50,CRS:189.65,BER:352,WPN:0,DST:157,BTV:0.00,RSP:35,***
+++ASP:1,THH:84,RLL:-23,PCH:4,***
+++ASP:5,THH:84,RLL:-26,PCH:5,***
+++ASP:5,THH:84,RLL:-28,PCH:7,***
+++ASP:-2,THH:84,RLL:-30,PCH:8,***
!!!LAT:32259300,LON:-110824216,SPD:12.61,CRT:0.00,ALT:41,ALH:50,CRS:184.83,BER:353,WPN:0,DST:173,BTV:0.00,RSP:35,***
+++ASP:2,THH:84,RLL:-34,PCH:4,***
+++ASP:-1,THH:84,RLL:-42,PCH:2,***
+++ASP:-1,THH:84,RLL:-38,PCH:1,***
+++ASP:-6,THH:84,RLL:-33,PCH:-1,***
!!!LAT:32259160,LON:-110824192,SPD:12.13,CRT:0.00,ALT:42,ALH:50,CRS:174.81,BER:353,WPN:0,DST:189,BTV:0.00,RSP:35,***
+++ASP:0,THH:84,RLL:-19,PCH:-8,***
+++ASP:-2,THH:84,RLL:-25,PCH:-9,***
+++ASP:-4,THH:84,RLL:-31,PCH:-9,***
+++ASP:-9,THH:84,RLL:-35,PCH:-11,***
!!!LAT:32259010,LON:-110824104,SPD:12.72,CRT:0.00,ALT:40,ALH:50,CRS:154.28,BER:351,WPN:0,DST:206,BTV:0.00,RSP:-35,***
+++ASP:-2,THH:84,RLL:-32,PCH:-15,***
+++ASP:-5,THH:84,RLL:-30,PCH:-16,***
+++ASP:3,THH:84,RLL:-30,PCH:-18,***
+++ASP:2,THH:84,RLL:-38,PCH:-16,***
!!!LAT:32258908,LON:-110823976,SPD:13.81,CRT:0.00,ALT:37,ALH:50,CRS:138.83,BER:348,WPN:0,DST:220,BTV:0.00,RSP:-35,***
+++ASP:-1,THH:84,RLL:-49,PCH:-11,***
+++ASP:3,THH:84,RLL:-51,PCH:-8,***
+++ASP:4,THH:84,RLL:-54,PCH:-7,***
+++ASP:-1,THH:84,RLL:-58,PCH:-3,***
!!!LAT:32258862,LON:-110823784,SPD:15.09,CRT:0.00,ALT:35,ALH:50,CRS:115.23,BER:344,WPN:0,DST:229,BTV:0.00,RSP:-35,***
+++ASP:7,THH:84,RLL:-60,PCH:-3,***
+++ASP:3,THH:84,RLL:-60,PCH:-6,***
+++ASP:5,THH:84,RLL:-60,PCH:-11,***
!!!LAT:32258946,LON:-110823576,SPD:13.72,CRT:0.00,ALT:32,ALH:50,CRS:69.78,BER:339,WPN:0,DST:226,BTV:0.00,RSP:-35,***
+++ASP:6,THH:84,RLL:-53,PCH:-14,***
+++ASP:9,THH:84,RLL:-46,PCH:-15,***
+++ASP:11,THH:84,RLL:-45,PCH:-14,***
+++ASP:11,THH:84,RLL:-42,PCH:-14,***
+++ASP:6,THH:84,RLL:-37,PCH:-14,***
!!!LAT:32259262,LON:-110823536,SPD:14.82,CRT:0.00,ALT:26,ALH:50,CRS:355.38,BER:334,WPN:0,DST:195,BTV:0.00,RSP:-10,***
+++ASP:9,THH:84,RLL:3,PCH:-26,***
+++ASP:10,THH:84,RLL:4,PCH:-21,***
+++ASP:7,THH:84,RLL:14,PCH:-19,***
+++ASP:6,THH:84,RLL:32,PCH:-19,***
!!!LAT:32259410,LON:-110823632,SPD:14.82,CRT:0.00,ALT:24,ALH:50,CRS:335.99,BER:334,WPN:0,DST:176,BTV:0.00,RSP:0,***
+++ASP:7,THH:84,RLL:43,PCH:-19,***
+++ASP:-4,THH:84,RLL:42,PCH:-10,***
+++ASP:-1,THH:84,RLL:15,PCH:-3,***
+++ASP:7,THH:84,RLL:-9,PCH:0,***
!!!LAT:32259598,LON:-110823696,SPD:14.24,CRT:0.00,ALT:20,ALH:50,CRS:343.94,BER:333,WPN:0,DST:155,BTV:0.00,RSP:-4,***
+++ASP:1,THH:84,RLL:-7,PCH:5,***
+++ASP:3,THH:84,RLL:-12,PCH:1,***
+++ASP:0,THH:84,RLL:-18,PCH:-2,***
+++ASP:-2,THH:84,RLL:-23,PCH:-3,***
!!!LAT:32259738,LON:-110823752,SPD:12.52,CRT:0.00,ALT:18,ALH:50,CRS:341.80,BER:332,WPN:0,DST:138,BTV:0.00,RSP:-4,***
+++ASP:-2,THH:84,RLL:-17,PCH:-3,***
+++ASP:0,THH:84,RLL:-17,PCH:-5,***
+++ASP:1,THH:84,RLL:-21,PCH:-8,***
+++ASP:0,THH:84,RLL:-22,PCH:-13,***
!!!LAT:32259858,LON:-110823840,SPD:11.60,CRT:0.00,ALT:17,ALH:50,CRS:333.84,BER:333,WPN:0,DST:123,BTV:0.00,RSP:0,***
+++ASP:0,THH:84,RLL:-11,PCH:-23,***
+++ASP:3,THH:84,RLL:10,PCH:-30,***
+++ASP:4,THH:84,RLL:20,PCH:-29,***
+++ASP:6,THH:84,RLL:15,PCH:-26,***
!!!LAT:32259960,LON:-110823936,SPD:12.15,CRT:0.00,ALT:14,ALH:50,CRS:326.46,BER:335,WPN:0,DST:108,BTV:0.00,RSP:4,***
+++ASP:3,THH:84,RLL:13,PCH:-18,***
+++ASP:5,THH:84,RLL:-3,PCH:-15,***
+++ASP:5,THH:84,RLL:-5,PCH:-14,***
!!!LAT:32260098,LON:-110824048,SPD:12.86,CRT:0.00,ALT:11,ALH:50,CRS:325.65,BER:337,WPN:0,DST:90,BTV:0.00,RSP:5,***
+++ASP:1,THH:84,RLL:-21,PCH:-20,***
+++ASP:3,THH:84,RLL:-17,PCH:-21,***
+++ASP:3,THH:84,RLL:-15,PCH:-19,***
+++ASP:-1,THH:84,RLL:-16,PCH:-18,***
!!!LAT:32260204,LON:-110824184,SPD:13.06,CRT:0.00,ALT:7,ALH:50,CRS:321.70,BER:342,WPN:0,DST:75,BTV:0.00,RSP:10,***
+++ASP:-1,THH:84,RLL:10,PCH:-16,***
+++ASP:5,THH:84,RLL:12,PCH:-7,***



Is This A Good Question/Topic? 0
  • +

Replies To: Beginner with python - need a little help

#2 baavgai   User is offline

  • Dreaming Coder
  • member icon


Reputation: 7507
  • View blog
  • Posts: 15,558
  • Joined: 16-October 07

Re: Beginner with python - need a little help

Posted 13 September 2010 - 05:42 PM

I would write your replace like this:
def replace_all(text):
	for c in '!ACBEDH*LONPSRTWV:':
		text = text.replace(c, '')
	return text



I'd keep the data that's there and just parse it for python, rather than all the work you seem to be doing:

e.g.
>>> def processLine(line):
...     if not line.startswith('!!!'):
...             return None
...     return dict([ s.split(':') for s in line[3:].split(',') if ':' in s ])
... 
>>> print processLine('!!!LAT:32259464,LON:-110823520,SPD:13.58,CRT:0.00,ALT:81,ALH:50,CRS:70.13,BER:330,WPN:0,DST:176,BTV:0.00,RSP:-35,***')
{'CRS': '70.13', 'BTV': '0.00', 'CRT': '0.00', 'ALH': '50', 'RSP': '-35', 'DST': '176', 'LON': '-110823520', 'BER': '330', 'WPN': '0', 'LAT': '32259464', 'ALT': '81', 'SPD': '13.58'}
>>> print processLine('!!!LAT:32259620,LON:-110823408,SPD:16.40,CRT:0.00,ALT:75,ALH:50,CRS:37.78,BER:325,WPN:0,DST:166,BTV:0.00,RSP:-35,***')
{'CRS': '37.78', 'BTV': '0.00', 'CRT': '0.00', 'ALH': '50', 'RSP': '-35', 'DST': '166', 'LON': '-110823408', 'BER': '325', 'WPN': '0', 'LAT': '32259620', 'ALT': '75', 'SPD': '16.40'}
>>> 



Now you can use the power of the dict to figure out how you want to do your output.
Was This Post Helpful? 0
  • +
  • -

#3 vwyodapink   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 141
  • Joined: 12-May 09

Re: Beginner with python - need a little help

Posted 13 September 2010 - 07:17 PM

I will have to read a little more I am not sure I am fully grasping the way your change works. Thanks for the input so far, I will try and play around some more with what you put up and see where I get from that.

This post has been edited by vwyodapink: 13 September 2010 - 07:19 PM

Was This Post Helpful? 0
  • +
  • -

#4 vwyodapink   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 141
  • Joined: 12-May 09

Re: Beginner with python - need a little help

Posted 13 September 2010 - 09:13 PM

View Postbaavgai, on 13 September 2010 - 04:42 PM, said:

I would write your replace like this:
def replace_all(text):
	for c in '!ACBEDH*LONPSRTWV:':
		text = text.replace(c, '')
	return text



I'd keep the data that's there and just parse it for python, rather than all the work you seem to be doing:

e.g.
>>> def processLine(line):
...     if not line.startswith('!!!'):
...             return None
...     return dict([ s.split(':') for s in line[3:].split(',') if ':' in s ])
... 
>>> print processLine('!!!LAT:32259464,LON:-110823520,SPD:13.58,CRT:0.00,ALT:81,ALH:50,CRS:70.13,BER:330,WPN:0,DST:176,BTV:0.00,RSP:-35,***')
{'CRS': '70.13', 'BTV': '0.00', 'CRT': '0.00', 'ALH': '50', 'RSP': '-35', 'DST': '176', 'LON': '-110823520', 'BER': '330', 'WPN': '0', 'LAT': '32259464', 'ALT': '81', 'SPD': '13.58'}
>>> print processLine('!!!LAT:32259620,LON:-110823408,SPD:16.40,CRT:0.00,ALT:75,ALH:50,CRS:37.78,BER:325,WPN:0,DST:166,BTV:0.00,RSP:-35,***')
{'CRS': '37.78', 'BTV': '0.00', 'CRT': '0.00', 'ALH': '50', 'RSP': '-35', 'DST': '166', 'LON': '-110823408', 'BER': '325', 'WPN': '0', 'LAT': '32259620', 'ALT': '75', 'SPD': '16.40'}
>>> 



Now you can use the power of the dict to figure out how you want to do your output.


Can you explain the print processLine part to me a little more please, the reason I ask is because to me the way you have it set up is that its as if the info coming in from /dev/ttyUSB0 is set.. The info is always changing and is coming in streaming. Or am I way off on my thinking?

This post has been edited by vwyodapink: 13 September 2010 - 09:14 PM

Was This Post Helpful? 0
  • +
  • -

#5 baavgai   User is offline

  • Dreaming Coder
  • member icon


Reputation: 7507
  • View blog
  • Posts: 15,558
  • Joined: 16-October 07

Re: Beginner with python - need a little help

Posted 14 September 2010 - 05:31 AM

View Postvwyodapink, on 13 September 2010 - 10:13 PM, said:

Can you explain the print processLine part to me a little more please, the reason I ask is because to me the way you have it set up is that its as if the info coming in from /dev/ttyUSB0 is set.. The info is always changing and is coming in streaming. Or am I way off on my thinking?


The code you offered doesn't really do anything. You show me the beginning of a program that takes command line parameters, creates an instance of gps, then basically ignores everything after that.

The next bit of code offered, with different indents, shows some xml thrown in a variable. Then a function just hanging out there that takes a dict later defined. Then a loop that presumably is reading from the stream, but can't be given the earlier code. In that loop you are parsing a line of a given criteria. Then you ultimately write a file with variable "output" that has never been shown before.

Given that the parsing looked overly messy, I offered the option of just quickly parsing it into a dictionary. The working on the line is just a proof of concept. You'd implement it with something like:
for line in feed:
	data = processLine(line)
	if data:
		processData(data) # whatever you're doing for output



I'm assuming you'd want to write each line to a different KML file. However, nothing shown comes close to doing that. From a design standpoint, you can write the code to do that by just working on one line of sample data. Once if works for the sample, then a test file. After that, point it at the feed and you're done.

This post has been edited by baavgai: 14 September 2010 - 05:32 AM

Was This Post Helpful? 0
  • +
  • -

#6 vwyodapink   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 141
  • Joined: 12-May 09

Re: Beginner with python - need a little help

Posted 14 September 2010 - 09:55 AM

OK the beginning of your reply makes sense and guess I got to far a head of myself with this one. I will have to try starting over. Though no I do not want each line as a new kml, the stream coming in should be rboken down into the format for the KML file as needed, one outputted kml file for each stream. If that makes anymore sense. If I made a kml for each line, there would be no way to networklink to GE I would have to reload each KML file in there after each file is made and pretty much defeats the purpose of what I want and thats a streaming kml for GE from the serial stream. The GPS is trying to give the serial stream to gpsd in the program which I need to do. Thanks again for your time, I will post back with what I can figure out from here.

Also the only part of the stream thats bein switched to the KML is just the stuff from the line beginning with !!! all of the info in +++ can be ignored

This post has been edited by vwyodapink: 14 September 2010 - 10:13 AM

Was This Post Helpful? 0
  • +
  • -

#7 baavgai   User is offline

  • Dreaming Coder
  • member icon


Reputation: 7507
  • View blog
  • Posts: 15,558
  • Joined: 16-October 07

Re: Beginner with python - need a little help

Posted 14 September 2010 - 11:14 AM

Well, I looked at the KML spec again and saw you wanted to mash them all up.

Just for fun, this works and seems to be what you're after. Alas, I couldn't see where seconds came from in your data.

#!/usr/bin/python

def processLine(line):
	if not line.startswith('!!!'):
		return None
	return dict([ s.split(':') for s in line[3:].split(',') if ':' in s ])

def getCoordsFromLine(line):
	fields = ('LAT','LON','ALT')
	data = processLine(line)
	if data and len([k for k in data.keys() if k in fields])==len(fields):
		results = [ data[k] for k in fields ]
		return ', '.join(results)
	return None

def getResults(coords):
	return u'''
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
	<Document>
		<name>your flight</name>
		<description></description>
		<Style id ="redline">
			<LineStyle><color>ff0000ff</color><width>4</width></LineStyle>
			<PolyStyle></PolyStyle>
		</Style>
		<Placemark>
			<name>your flight</name>
			<description></description>
			<styleUrl>#redline</styleUrl>
			<LineString>
				<extrude>0</extrude>
				<tessellate>0</tessellate>
				<altitudeMode>relativeToGround</altitudeMode>
				<coordinates> ''' + '\n'.join(coords) + ''' </coordinates>
			</LineString>
		</Placemark>
	</Document>
</kml>
'''


def processFeed():
	coords = []
	for line in getRawData(): # this would be your serial feed
		c = getCoordsFromLine(line)
		if c:
			coords.append(c)
	if len(coords)>0:
		return getResults(coords)
	return None

# this would open and read your port.  Since we don't have that for testing; this should do.
def getRawData():
	return '''
+++ASP:-1,THH:1,RLL:-60,PCH:-9,***
+++ASP:0,THH:0,RLL:-60,PCH:-10,***
!!!LAT:32259464,LON:-110823520,SPD:13.58,CRT:0.00,ALT:81,ALH:50,CRS:70.13,BER:330,WPN:0,DST:176,BTV:0.00,RSP:-35,***
+++ASP:1,THH:0,RLL:-60,PCH:-11,***
+++ASP:7,THH:0,RLL:-60,PCH:-12,***
+++ASP:8,THH:0,RLL:-60,PCH:-15,***
+++ASP:7,THH:0,RLL:-60,PCH:-18,***
!!!LAT:32259620,LON:-110823408,SPD:16.40,CRT:0.00,ALT:75,ALH:50,CRS:37.78,BER:325,WPN:0,DST:166,BTV:0.00,RSP:-35,***
+++ASP:18,THH:0,RLL:-60,PCH:-16,***
+++ASP:20,THH:0,RLL:-58,PCH:-22,***
+++ASP:18,THH:0,RLL:-60,PCH:-20,***
+++ASP:28,THH:0,RLL:-60,PCH:-18,***
!!!LAT:32259812,LON:-110823448,SPD:17.96,CRT:0.00,ALT:68,ALH:50,CRS:344.19,BER:321,WPN:0,DST:147,BTV:0.00,RSP:-11,***
+++ASP:25,THH:0,RLL:-43,PCH:-21,***
+++ASP:27,THH:0,RLL:-17,PCH:-29,***
+++ASP:30,THH:0,RLL:-3,PCH:-29,***
+++ASP:23,THH:0,RLL:-8,PCH:-27,***
!!!LAT:32259986,LON:-110823656,SPD:18.79,CRT:0.00,ALT:60,ALH:50,CRS:317.39,BER:322,WPN:0,DST:120,BTV:0.00,RSP:2,***
+++ASP:25,THH:0,RLL:-8,PCH:-19,***
+++ASP:23,THH:0,RLL:-16,PCH:-18,***
+++ASP:26,THH:0,RLL:-18,PCH:-18,***
+++ASP:27,THH:0,RLL:-14,PCH:-21,***
!!!LAT:32260128,LON:-110823864,SPD:19.41,CRT:0.00,ALT:57,ALH:50,CRS:310.51,BER:326,WPN:0,DST:96,BTV:0.00,RSP:7,***
+++ASP:19,THH:6,RLL:-25,PCH:-1,***
!!!LAT:32260246,LON:-110824072,SPD:18.08,CRT:0.00,ALT:55,ALH:50,CRS:302.32,BER:333,WPN:0,DST:74,BTV:0.00,RSP:15,***
+++ASP:16,THH:40,RLL:-34,PCH:19,***
+++ASP:16,THH:48,RLL:-41,PCH:24,***
+++ASP:11,THH:26,RLL:-32,PCH:30,***
+++ASP:9,THH:30,RLL:-6,PCH:34,***
+++ASP:9,THH:14,RLL:13,PCH:35,***
+++ASP:2,THH:9,RLL:6,PCH:23,***
+++ASP:4,THH:2,RLL:7,PCH:17,***
+++ASP:-1,THH:6,RLL:10,PCH:11,***
+++ASP:-2,THH:3,RLL:10,PCH:9,***
!!!LAT:32260468,LON:-110824768,SPD:11.78,CRT:0.00,ALT:66,ALH:50,CRS:295.40,BER:36,WPN:0,DST:53,BTV:0.00,RSP:35,***
+++ASP:0,THH:1,RLL:32,PCH:-6,***
+++ASP:1,THH:1,RLL:30,PCH:-6,***
+++ASP:1,THH:0,RLL:26,PCH:-8,***
+++ASP:0,THH:0,RLL:19,PCH:-9,***
!!!LAT:32260548,LON:-110824896,SPD:13.19,CRT:0.00,ALT:64,ALH:50,CRS:303.15,BER:53,WPN:0,DST:55,BTV:0.00,RSP:35,***
+++ASP:2,THH:1,RLL:1,PCH:-6,***
+++ASP:3,THH:0,RLL:0,PCH:-5,***
+++ASP:6,THH:0,RLL:-9,PCH:0,***
+++ASP:2,THH:0,RLL:-21,PCH:3,***
+++ASP:2,THH:0,RLL:-29,PCH:5,***
!!!LAT:32260766,LON:-110825200,SPD:13.50,CRT:0.00,ALT:61,ALH:50,CRS:308.91,BER:82,WPN:0,DST:73,BTV:0.00,RSP:35,***
+++ASP:-4,THH:0,RLL:-56,PCH:7,***
+++ASP:-1,THH:1,RLL:-59,PCH:6,***
+++ASP:-2,THH:3,RLL:-60,PCH:3,***
+++ASP:0,THH:4,RLL:-60,PCH:4,***
!!!LAT:32260814,LON:-110825368,SPD:12.01,CRT:0.00,ALT:60,ALH:50,CRS:289.85,BER:87,WPN:0,DST:89,BTV:0.00,RSP:35,***
+++ASP:-4,THH:7,RLL:-60,PCH:4,***
+++ASP:-1,THH:6,RLL:-60,PCH:2,***
+++ASP:-1,THH:18,RLL:-60,PCH:-1,***
+++ASP:-3,THH:22,RLL:-60,PCH:-2,***
!!!LAT:32260738,LON:-110825520,SPD:11.15,CRT:0.00,ALT:57,ALH:50,CRS:247.85,BER:83,WPN:0,DST:104,BTV:0.00,RSP:-35,***
+++ASP:-1,THH:47,RLL:-60,PCH:-6,***
+++ASP:-1,THH:59,RLL:-60,PCH:-7,***
+++ASP:2,THH:76,RLL:-60,PCH:-9,***
+++ASP:-2,THH:81,RLL:-60,PCH:-11,***
!!!LAT:32260608,LON:-110825536,SPD:12.14,CRT:0.00,ALT:53,ALH:50,CRS:207.07,BER:75,WPN:0,DST:108,BTV:0.00,RSP:-35,***
+++ASP:3,THH:84,RLL:-60,PCH:-10,***
+++ASP:4,THH:84,RLL:-47,PCH:-13,***
+++ASP:8,THH:84,RLL:-17,PCH:-17,***
+++ASP:6,THH:84,RLL:8,PCH:-18,***
!!!LAT:32260482,LON:-110825448,SPD:14.34,CRT:0.00,ALT:49,ALH:50,CRS:148.01,BER:67,WPN:0,DST:104,BTV:0.00,RSP:-35,***
+++ASP:8,THH:84,RLL:28,PCH:-10,***
+++ASP:6,THH:84,RLL:20,PCH:-5,***
+++ASP:6,THH:84,RLL:13,PCH:-6,***
+++ASP:5,THH:84,RLL:11,PCH:-11,***
!!!LAT:32260360,LON:-110825304,SPD:13.91,CRT:0.00,ALT:48,ALH:50,CRS:138.20,BER:56,WPN:0,DST:98,BTV:0.00,RSP:-35,***
+++ASP:8,THH:84,RLL:9,PCH:-12,***
+++ASP:7,THH:84,RLL:4,PCH:-8,***
+++ASP:5,THH:84,RLL:2,PCH:-11,***
+++ASP:1,THH:84,RLL:-13,PCH:-14,***
!!!LAT:32260220,LON:-110825152,SPD:13.91,CRT:0.00,ALT:46,ALH:50,CRS:138.22,BER:44,WPN:0,DST:97,BTV:0.00,RSP:-35,***
+++ASP:6,THH:84,RLL:-30,PCH:-11,***
+++ASP:4,THH:84,RLL:-38,PCH:-7,***
+++ASP:2,THH:84,RLL:-41,PCH:-7,***
!!!LAT:32260120,LON:-110825000,SPD:14.26,CRT:0.00,ALT:46,ALH:50,CRS:129.81,BER:33,WPN:0,DST:97,BTV:0.00,RSP:-35,***
+++ASP:4,THH:84,RLL:-48,PCH:-6,***
+++ASP:3,THH:84,RLL:-51,PCH:-8,***
+++ASP:5,THH:84,RLL:-56,PCH:-8,***
+++ASP:2,THH:84,RLL:-40,PCH:-1,***
!!!LAT:32260074,LON:-110824792,SPD:14.64,CRT:0.00,ALT:46,ALH:50,CRS:110.63,BER:21,WPN:0,DST:92,BTV:0.00,RSP:-35,***
+++ASP:5,THH:84,RLL:27,PCH:-2,***
+++ASP:-1,THH:84,RLL:45,PCH:-2,***
+++ASP:2,THH:84,RLL:60,PCH:-5,***
+++ASP:1,THH:84,RLL:60,PCH:-1,***
!!!LAT:32260066,LON:-110824600,SPD:14.19,CRT:0.00,ALT:47,ALH:50,CRS:97.08,BER:10,WPN:0,DST:88,BTV:0.00,RSP:-35,***
+++ASP:0,THH:84,RLL:52,PCH:-4,***
+++ASP:0,THH:84,RLL:46,PCH:-6,***
+++ASP:3,THH:84,RLL:37,PCH:-6,***
+++ASP:3,THH:84,RLL:27,PCH:-6,***
!!!LAT:32259998,LON:-110824408,SPD:13.57,CRT:0.00,ALT:47,ALH:50,CRS:110.83,BER:359,WPN:0,DST:94,BTV:0.00,RSP:-35,***
+++ASP:2,THH:84,RLL:23,PCH:-2,***
+++ASP:3,THH:84,RLL:27,PCH:-2,***
+++ASP:1,THH:84,RLL:45,PCH:-4,***
+++ASP:2,THH:84,RLL:60,PCH:-7,***
!!!LAT:32259902,LON:-110824256,SPD:13.08,CRT:0.00,ALT:48,ALH:50,CRS:118.53,BER:351,WPN:0,DST:106,BTV:0.00,RSP:-35,***
+++ASP:-2,THH:84,RLL:60,PCH:-10,***
+++ASP:3,THH:84,RLL:60,PCH:-11,***
+++ASP:6,THH:84,RLL:60,PCH:-13,***
+++ASP:4,THH:84,RLL:60,PCH:-15,***
!!!LAT:32259780,LON:-110824168,SPD:12.32,CRT:0.00,ALT:47,ALH:50,CRS:141.34,BER:348,WPN:0,DST:121,BTV:0.02,RSP:-35,***
+++ASP:4,THH:84,RLL:55,PCH:-18,***
+++ASP:5,THH:84,RLL:49,PCH:-19,***
+++ASP:5,THH:84,RLL:43,PCH:-19,***
+++ASP:6,THH:84,RLL:37,PCH:-21,***
!!!LAT:32259606,LON:-110824152,SPD:13.51,CRT:0.00,ALT:42,ALH:50,CRS:171.33,BER:349,WPN:0,DST:140,BTV:0.00,RSP:35,***
+++ASP:8,THH:84,RLL:20,PCH:-17,***
+++ASP:6,THH:84,RLL:5,PCH:-9,***
+++ASP:8,THH:84,RLL:1,PCH:-6,***
+++ASP:7,THH:84,RLL:-4,PCH:-2,***
!!!LAT:32259446,LON:-110824200,SPD:13.76,CRT:0.00,ALT:40,ALH:50,CRS:189.65,BER:352,WPN:0,DST:157,BTV:0.00,RSP:35,***
+++ASP:1,THH:84,RLL:-23,PCH:4,***
+++ASP:5,THH:84,RLL:-26,PCH:5,***
+++ASP:5,THH:84,RLL:-28,PCH:7,***
+++ASP:-2,THH:84,RLL:-30,PCH:8,***
!!!LAT:32259300,LON:-110824216,SPD:12.61,CRT:0.00,ALT:41,ALH:50,CRS:184.83,BER:353,WPN:0,DST:173,BTV:0.00,RSP:35,***
+++ASP:2,THH:84,RLL:-34,PCH:4,***
+++ASP:-1,THH:84,RLL:-42,PCH:2,***
+++ASP:-1,THH:84,RLL:-38,PCH:1,***
+++ASP:-6,THH:84,RLL:-33,PCH:-1,***
!!!LAT:32259160,LON:-110824192,SPD:12.13,CRT:0.00,ALT:42,ALH:50,CRS:174.81,BER:353,WPN:0,DST:189,BTV:0.00,RSP:35,***
+++ASP:0,THH:84,RLL:-19,PCH:-8,***
+++ASP:-2,THH:84,RLL:-25,PCH:-9,***
+++ASP:-4,THH:84,RLL:-31,PCH:-9,***
+++ASP:-9,THH:84,RLL:-35,PCH:-11,***
!!!LAT:32259010,LON:-110824104,SPD:12.72,CRT:0.00,ALT:40,ALH:50,CRS:154.28,BER:351,WPN:0,DST:206,BTV:0.00,RSP:-35,***
+++ASP:-2,THH:84,RLL:-32,PCH:-15,***
+++ASP:-5,THH:84,RLL:-30,PCH:-16,***
+++ASP:3,THH:84,RLL:-30,PCH:-18,***
+++ASP:2,THH:84,RLL:-38,PCH:-16,***
!!!LAT:32258908,LON:-110823976,SPD:13.81,CRT:0.00,ALT:37,ALH:50,CRS:138.83,BER:348,WPN:0,DST:220,BTV:0.00,RSP:-35,***
+++ASP:-1,THH:84,RLL:-49,PCH:-11,***
+++ASP:3,THH:84,RLL:-51,PCH:-8,***
+++ASP:4,THH:84,RLL:-54,PCH:-7,***
+++ASP:-1,THH:84,RLL:-58,PCH:-3,***
!!!LAT:32258862,LON:-110823784,SPD:15.09,CRT:0.00,ALT:35,ALH:50,CRS:115.23,BER:344,WPN:0,DST:229,BTV:0.00,RSP:-35,***
+++ASP:7,THH:84,RLL:-60,PCH:-3,***
+++ASP:3,THH:84,RLL:-60,PCH:-6,***
+++ASP:5,THH:84,RLL:-60,PCH:-11,***
!!!LAT:32258946,LON:-110823576,SPD:13.72,CRT:0.00,ALT:32,ALH:50,CRS:69.78,BER:339,WPN:0,DST:226,BTV:0.00,RSP:-35,***
+++ASP:6,THH:84,RLL:-53,PCH:-14,***
+++ASP:9,THH:84,RLL:-46,PCH:-15,***
+++ASP:11,THH:84,RLL:-45,PCH:-14,***
+++ASP:11,THH:84,RLL:-42,PCH:-14,***
+++ASP:6,THH:84,RLL:-37,PCH:-14,***
!!!LAT:32259262,LON:-110823536,SPD:14.82,CRT:0.00,ALT:26,ALH:50,CRS:355.38,BER:334,WPN:0,DST:195,BTV:0.00,RSP:-10,***
+++ASP:9,THH:84,RLL:3,PCH:-26,***
+++ASP:10,THH:84,RLL:4,PCH:-21,***
+++ASP:7,THH:84,RLL:14,PCH:-19,***
+++ASP:6,THH:84,RLL:32,PCH:-19,***
!!!LAT:32259410,LON:-110823632,SPD:14.82,CRT:0.00,ALT:24,ALH:50,CRS:335.99,BER:334,WPN:0,DST:176,BTV:0.00,RSP:0,***
+++ASP:7,THH:84,RLL:43,PCH:-19,***
+++ASP:-4,THH:84,RLL:42,PCH:-10,***
+++ASP:-1,THH:84,RLL:15,PCH:-3,***
+++ASP:7,THH:84,RLL:-9,PCH:0,***
!!!LAT:32259598,LON:-110823696,SPD:14.24,CRT:0.00,ALT:20,ALH:50,CRS:343.94,BER:333,WPN:0,DST:155,BTV:0.00,RSP:-4,***
+++ASP:1,THH:84,RLL:-7,PCH:5,***
+++ASP:3,THH:84,RLL:-12,PCH:1,***
+++ASP:0,THH:84,RLL:-18,PCH:-2,***
+++ASP:-2,THH:84,RLL:-23,PCH:-3,***
!!!LAT:32259738,LON:-110823752,SPD:12.52,CRT:0.00,ALT:18,ALH:50,CRS:341.80,BER:332,WPN:0,DST:138,BTV:0.00,RSP:-4,***
+++ASP:-2,THH:84,RLL:-17,PCH:-3,***
+++ASP:0,THH:84,RLL:-17,PCH:-5,***
+++ASP:1,THH:84,RLL:-21,PCH:-8,***
+++ASP:0,THH:84,RLL:-22,PCH:-13,***
!!!LAT:32259858,LON:-110823840,SPD:11.60,CRT:0.00,ALT:17,ALH:50,CRS:333.84,BER:333,WPN:0,DST:123,BTV:0.00,RSP:0,***
+++ASP:0,THH:84,RLL:-11,PCH:-23,***
+++ASP:3,THH:84,RLL:10,PCH:-30,***
+++ASP:4,THH:84,RLL:20,PCH:-29,***
+++ASP:6,THH:84,RLL:15,PCH:-26,***
!!!LAT:32259960,LON:-110823936,SPD:12.15,CRT:0.00,ALT:14,ALH:50,CRS:326.46,BER:335,WPN:0,DST:108,BTV:0.00,RSP:4,***
+++ASP:3,THH:84,RLL:13,PCH:-18,***
+++ASP:5,THH:84,RLL:-3,PCH:-15,***
+++ASP:5,THH:84,RLL:-5,PCH:-14,***
!!!LAT:32260098,LON:-110824048,SPD:12.86,CRT:0.00,ALT:11,ALH:50,CRS:325.65,BER:337,WPN:0,DST:90,BTV:0.00,RSP:5,***
+++ASP:1,THH:84,RLL:-21,PCH:-20,***
+++ASP:3,THH:84,RLL:-17,PCH:-21,***
+++ASP:3,THH:84,RLL:-15,PCH:-19,***
+++ASP:-1,THH:84,RLL:-16,PCH:-18,***
!!!LAT:32260204,LON:-110824184,SPD:13.06,CRT:0.00,ALT:7,ALH:50,CRS:321.70,BER:342,WPN:0,DST:75,BTV:0.00,RSP:10,***
+++ASP:-1,THH:84,RLL:10,PCH:-16,***
+++ASP:5,THH:84,RLL:12,PCH:-7,***
'''.split('\n')

# print results. you could write this to a file
print processFeed()


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1