ogn-python/ogn_python/model/airport.py

38 wiersze
1.2 KiB
Python
Czysty Zwykły widok Historia

2017-10-03 11:31:24 +00:00
from geoalchemy2.types import Geometry
2016-04-22 08:44:39 +00:00
from ogn_python import db
2016-04-22 08:44:39 +00:00
2019-02-10 12:10:19 +00:00
class Airport(db.Model):
__tablename__ = "airports"
2016-04-22 08:44:39 +00:00
2019-02-10 12:25:24 +00:00
id = db.Column(db.Integer, primary_key=True)
2016-04-22 08:44:39 +00:00
2019-02-10 12:25:24 +00:00
location_wkt = db.Column('location', Geometry('POINT', srid=4326))
altitude = db.Column(db.Float(precision=2))
2019-02-10 12:25:24 +00:00
name = db.Column(db.String, index=True)
code = db.Column(db.String(6))
country_code = db.Column(db.String(2))
style = db.Column(db.SmallInteger)
description = db.Column(db.String)
runway_direction = db.Column(db.SmallInteger)
runway_length = db.Column(db.SmallInteger)
frequency = db.Column(db.Float(precision=2))
2016-04-22 08:44:39 +00:00
2019-02-10 12:25:24 +00:00
border = db.Column('border', Geometry('POLYGON', srid=4326))
2019-01-01 19:12:25 +00:00
2016-04-22 08:44:39 +00:00
def __repr__(self):
return "<Airport %s: %s,%s,%s,%s,%s,%s,%s,%s,%s,% s>" % (
self.name,
self.code,
self.country_code,
self.style,
self.description,
2017-10-03 10:59:45 +00:00
self.location_wkt.latitude if self.location_wkt else None,
self.location_wkt.longitude if self.location_wkt else None,
2016-04-22 08:44:39 +00:00
self.altitude,
self.runway_direction,
self.runway_length,
self.frequency)