Add get_osm method to Line class

This commit is contained in:
Edward Betts 2021-07-16 11:14:49 +02:00
parent 66904c061a
commit a56387c4d9

View file

@ -288,6 +288,11 @@ class Line(MapMixin, Base):
def type(self):
return "way" if self.src_id > 0 else "relation"
@classmethod
def get_osm(cls, osm_type, osm_id):
src_id = osm_id * {'way': 1, 'relation': -1}[osm_type]
return cls.query.get(src_id)
class Polygon(MapMixin, Base):
way_area = Column(Float)