Beispiel #1
0
 def get(self):
   AprsStorage.get()
   MockTelemetry.inject_packets()
   top_altitudes = map(TrackingManager.get().get_top_altitude, KmlStyleUtils.TOP_ALTITUDES_CALLSIGNS)
   if self.request.path == '/alt/v':
     for callsign, top_altitude in zip(KmlStyleUtils.TOP_ALTITUDES_CALLSIGNS, top_altitudes):
       label = callsign+KmlStyleUtils.get_callsign_info(callsign)
       self.response.out.write('%f %f %s<br>\n' % (top_altitude, 3.281 * top_altitude, label))
   elif self.request.path == '/trk/':
     self.response.out.write('<table cellpadding="0" cellspacing="15">\n')
     self.response.out.write('<tr><th align="left">Callsign</th><th align="left">Last reported position</th>\n')
     for id_, tpm in TrackingManager.get().placemarks.items():
       callsign = tpm.callsign
       last_packet = tpm.last_packet
       if (last_packet is not None) and (last_packet.position is not None):
         position = last_packet.position
         zoom_level = 19
         pos_url = 'geo:%.5f,%.5f?z=%d&q=loc:%.5f%%2c%.5f' % (position[0], position[1], 20, position[0], position[1])
         label = '<a href="%s">%s</a>%s' % (pos_url, callsign, KmlStyleUtils.get_callsign_info(callsign))
         pos_info = 'lat=%10.5f lon=%10.5f alt=%8.1f' % (position[0], position[1], position[2])
       else:
         label = callsign+KmlStyleUtils.get_callsign_info(callsign)
         pos_info = 'n/a'
       self.response.out.write('<tr><td>%s</td><td>%s</td></tr>\n' % (label, pos_info))
     self.response.out.write('</table>\n')
   else:
     self.response.out.write(int(max(top_altitudes)))
Beispiel #2
0
 def get(self):
   AprsStorage.get()
   MockTelemetry.inject_packets()
   sid = int(self.request.get('sid', 0))
   session = GoogleEarthSession.get(sid)
   if session is None:
     self.redirect(self.request.path_url)
     return
   self.response.headers['Content-Type'] = XML_MIME
   session.serve_kml(self.request, self.response)