def takeoff_location(self): if self.takeoff_location_wkt is None: return None wkt = DBSession.scalar(self.takeoff_location_wkt.wkt) return Location.from_wkt(wkt)
def landing_location(self): if self.landing_location_wkt is None: return None wkt = DBSession.scalar(self.landing_location_wkt.wkt) return Location.from_wkt(wkt)
def distance(self, location): loc1 = cast(self.location_wkt.wkt, 'geography') loc2 = func.ST_GeographyFromText(location.to_wkt()) return DBSession.scalar(func.ST_Distance(loc1, loc2))