ogn-python/ogn/model/airport.py

41 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 sqlalchemy import Column, String, Integer, Float, SmallInteger
from sqlalchemy.orm import relationship
2016-04-22 08:44:39 +00:00
from .base import Base
class Airport(Base):
__tablename__ = "airport"
id = Column(Integer, primary_key=True)
location_wkt = Column('location', Geometry('POINT', srid=4326))
altitude = Column(Integer)
2016-04-22 08:44:39 +00:00
name = Column(String, index=True)
code = Column(String(6))
2016-04-22 08:44:39 +00:00
country_code = Column(String(2))
style = Column(SmallInteger)
description = Column(String)
runway_direction = Column(Integer)
runway_length = Column(Integer)
frequency = Column(Float)
# Relations
takeoff_landings = relationship('TakeoffLanding')
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)