Exemplo n.º 1
0
 def gpxwpt(self, dbobj, xmlobj, sequence):
     pt = GPXpoint(headerid = dbobj, pointtype='wpt', unitnumber=sequence, segment=0, pointorder=0)
     pt.lat = float(xmlobj.get('lat'))
     pt.lon = float(xmlobj.get('lon'))
     #if xmlobj.findtext(utils.gpxtime_elementname): pt.pointtime = datetime.strptime(xmlobj.findtext(utils.gpxtime_elementname), '%Y-%m-%dT%H:%M:%S')
     if xmlobj.findtext(utils.gpxtime_elementname): pt.dateraw = xmlobj.findtext(utils.gpxtime_elementname)
     if xmlobj.findtext(utils.gpxcmt_elementname): pt.cmt = xmlobj.findtext(utils.gpxcmt_elementname)
     if xmlobj.findtext(utils.gpxdesc_elementname): pt.desc = xmlobj.findtext(utils.gpxdesc_elementname)
     if xmlobj.findtext(utils.gpxname_elementname): pt.name = xmlobj.findtext(utils.gpxname_elementname)
     pt.put()
Exemplo n.º 2
0
 def gpxrte(self, dbobj, xmlobj, sequence):
     pt = GPXpoint(headerid = dbobj, pointtype='rte', unitnumber=sequence, segment=0, pointorder=0)
     if xmlobj.findtext(utils.gpxname_elementname): pt.name = xmlobj.findtext(utils.gpxname_elementname)
     if xmlobj.findtext(utils.gpxcmt_elementname): pt.cmt = xmlobj.findtext(utils.gpxcmt_elementname)
     if xmlobj.findtext(utils.gpxdesc_elementname): pt.desc = xmlobj.findtext(utils.gpxdesc_elementname)
     pt.put()
     nopts = 0
     for xpt in xmlobj:
         if xpt.tag == utils.gpxrtept_elementname:
             nopts += 1
             logging.info("toroam.com: childs %s %s", xpt.tag, xpt.attrib)
             pt = GPXpoint(headerid = dbobj, pointtype='rtept', unitnumber=sequence, segment=0, pointorder=nopts)
             if xpt.get('lat'): pt.lat = float(xpt.get('lat'))
             if xpt.get('lon'): pt.lon = float(xpt.get('lon'))
             if xpt.findtext(utils.gpxname_elementname): pt.name = xpt.findtext(utils.gpxname_elementname)
             if xpt.findtext(utils.gpxtime_elementname): pt.dateraw = xpt.findtext(utils.gpxtime_elementname)
             if xpt.findtext(utils.gpxcmt_elementname): pt.cmt = xpt.findtext(utils.gpxcmt_elementname)
             if xpt.findtext(utils.gpxdesc_elementname): pt.desc = xpt.findtext(utils.gpxdesc_elementname)
             pt.put()