From a56387c4d9afc95144d6a56a2558afeeeca4301f Mon Sep 17 00:00:00 2001
From: Edward Betts <edward@4angle.com>
Date: Fri, 16 Jul 2021 11:14:49 +0200
Subject: [PATCH] Add get_osm method to Line class

---
 matcher/model.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/matcher/model.py b/matcher/model.py
index dbab7b0..eeaa1b5 100644
--- a/matcher/model.py
+++ b/matcher/model.py
@@ -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)