7 from urllib2 import unquote
13 def write_parsed_to_db(db,gpx,filename):
15 conn = sqlite3.connect(db)
18 cur.execute ("delete from tracks where filename=?" , (filename.decode('UTF-8'),))
36 cur.execute("insert into authors(name,description) values(?,?)", (author,''))
37 print "created author %s" % (author)
39 print "failed to create author %s" % (author)
47 printable = pyosmname.GeoName(start.lat,start.lon).printable
48 start_time = track.start_time()
49 full_duration = track.full_duration().total_seconds()
50 distance = track.distance()
51 filtered_distance = track.filtered_distance(max_speed=50)
52 ascent = track.elevation_gain()
53 descent = track.elevation_loss()
54 ((minlat,minlon),(maxlat,maxlon)) = track.bound_box()
56 gpx.author,name,filename.decode('UTF-8'),
57 track.sport,start_time,full_duration,
58 distance,filtered_distance,ascent,descent,
61 minlat,minlon,maxlat,maxlon
65 author,name,filename,sport,
67 distance,distance_filtered,
69 lat,lon,printable_location,minlat,minlon,maxlat,maxlon)
71 ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
75 print "created track %s" % (filename)
81 def write_tree_to_db(db,tree,filename):
86 write_parsed_to_db(db,gpx,filename)